-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
39b3ab2
commit 7c15ab4
Showing
5 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Oct21/chef-starter/chef-repo/cookbooks/springbootexample/recipes/configuremysql.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Cookbook:: . | ||
# Recipe:: configuremysql | ||
# | ||
# Copyright:: 2021, The Authors, All Rights Reserved. | ||
|
||
mysql_service 'qt' do | ||
port '3306' | ||
version '8.0' | ||
initial_root_password 'rootroot' | ||
action [:create, :start] | ||
end | ||
|
||
mysql_client 'default' do | ||
action :create | ||
end | ||
|
||
mysql_database 'qtecommerce' do | ||
host '127.0.0.1' | ||
user 'root' | ||
password 'rootroot' | ||
action :create | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ef-starter/chef-repo/cookbooks/springbootexample/spec/unit/recipes/configuremysql_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# Cookbook:: . | ||
# Spec:: configuremysql | ||
# | ||
# Copyright:: 2021, The Authors, All Rights Reserved. | ||
|
||
require 'spec_helper' | ||
|
||
describe '.::configuremysql' do | ||
context 'When all attributes are default, on Ubuntu 20.04' do | ||
# for a complete list of available platforms and versions see: | ||
# https://github.com/chefspec/fauxhai/blob/main/PLATFORMS.md | ||
platform 'ubuntu', '20.04' | ||
|
||
it 'converges successfully' do | ||
expect { chef_run }.to_not raise_error | ||
end | ||
end | ||
|
||
context 'When all attributes are default, on CentOS 8' do | ||
# for a complete list of available platforms and versions see: | ||
# https://github.com/chefspec/fauxhai/blob/main/PLATFORMS.md | ||
platform 'centos', '8' | ||
|
||
it 'converges successfully' do | ||
expect { chef_run }.to_not raise_error | ||
end | ||
end | ||
end |
16 changes: 16 additions & 0 deletions
16
...ter/chef-repo/cookbooks/springbootexample/test/integration/default/configuremysql_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Chef InSpec test for recipe .::configuremysql | ||
|
||
# The Chef InSpec reference, with examples and extensive documentation, can be | ||
# found at https://docs.chef.io/inspec/resources/ | ||
|
||
unless os.windows? | ||
# This is an example test, replace with your own test. | ||
describe user('root'), :skip do | ||
it { should exist } | ||
end | ||
end | ||
|
||
# This is an example test, replace it with your own test. | ||
describe port(80), :skip do | ||
it { should_not be_listening } | ||
end |