ͯ͠ʢςετέʔεʣͦͷঢ় ଶʹͳ͍ͬͯΔ͔Λςετ͢ Δπʔϧ • ྫ ʮ.Z42-͕ಈ͍͍ͯΔ͔ʯ ʮઃఆϑΝΠϧ͕దʹ ੜ͞Ε͍ͯΔ͔ʯ describe package('mysql-server') do it { should be_installed } end ! describe service('mysql') do it { should be_running } end ! describe port(3306) do it { should be_listening } end ! describe file('/etc/my.cnf') do it { should be_file } it { should_not contain "mysqld_multi" } it { should_not contain "skip-innodb" } it { should contain "port = 3306" } end Vagrant (VirtualBox) Chef ςετ (via SSH) serverspec ΫοΫϒοΫ
7JSUVBM#PYͷ*OUFSOBM/FUXPSLΛͬͯ ωοτϫʔΫΛ͚Δ platforms: - name: gree-ubuntu-12.04 driver_config: network: - ["private_network", {ip: "192.168.10.44", virtualbox__intnet: "mysql-cookbook"}] Test Kitchen Ͱ Internal Network Λ͏ྫ ʢmysql-cookbook ༻ͷωοτϫʔΫ͕Ͱ͖Δʣ Host VM VM VM VM VM
ϢχοτςεςΟϯά ϑϨʔϜϫʔΫ • ओʹɺσϑΥϧτͷςετ Λॻ͍͍ͯΔ • ݅͝ͱͷΛςετ • 7.Λར༻͠ͳ͍ͷͰૣ͍ • TFSWFSTQFDͱඃΔ෦ ॻ͔ͳ͍ describe "node['apache']['port']" do context "when node['apache']['port'] is nil" do let(:attributes) do {} end it "returns default port number" do expect(chef_run.node['apache'] ['port']).to eq(80) end end end