Skip to content

Commit

Permalink
Added usage of mysql cookbook
Browse files Browse the repository at this point in the history
  • Loading branch information
qtkhajacloud committed Nov 14, 2021
1 parent 39b3ab2 commit 7c15ab4
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
# a Supermarket.
#
# source_url 'https://github.com/<insert_org_here>/springbootexample'

depends 'mysql', '~> 11.0.0'
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

Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
# Copyright:: 2021, The Authors, All Rights Reserved.

include_recipe 'springbootexample::java'
include_recipe 'springbootexample::configuremysql'
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
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

0 comments on commit 7c15ab4

Please sign in to comment.