Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate ServerSpec to InSpec #30

Merged
merged 9 commits into from May 22, 2019
Merged

Migrate ServerSpec to InSpec #30

merged 9 commits into from May 22, 2019

Conversation

khashf
Copy link
Contributor

@khashf khashf commented May 14, 2019

No description provided.

@khashf khashf added the WIP label May 14, 2019
@khashf khashf self-assigned this May 14, 2019
@khashf
Copy link
Contributor Author

khashf commented May 14, 2019

@khashf khashf force-pushed the freefood/migrate_to_inspec branch from aa09018 to fb3f11c Compare May 15, 2019 00:26
cron to crontab and process to processes
@khashf
Copy link
Contributor Author

khashf commented May 15, 2019

I'm running into two issues

InSpec processes resource:

  Processes mysqld_safe
     ∅  states should eq ["R<"]
     
     expected: ["R<"]
          got: ["Ss"]
     
     (compared using ==)

  Processes mysqld
     ∅  states should eq ["R<"]
     
     expected: ["R<"]
          got: ["Sl"]
     
     (compared using ==)

Package percona-xtrabackup.x86_64 not found

  System Package percona-xtrabackup.x86_64
     ∅  should be installed
     expected System Package percona-xtrabackup.x86_64 to be installed

I did kitchen login and saw:
xtrabackup-centos-6 instance:

[centos@xtrabackuprbcen-freefood-turquoise-it28wv6 ~]$ rpm -qa | grep "percona"
percona-xtrabackup-2.3.10-1.el6.x86_64

xtrabackup-centos-7 instance:

[centos@xtrabackuprbcen-freefood-turquoise-vbu78if ~]$ rpm -qa | grep "percona"
percona-xtrabackup-2.3.10-1.el7.x86_64

I changed the test from looking for percona-xtrabackup.x86_64 package to looking for percona-xtrabackup-2.3.10-1.el7.x86_64 but it didn't pass either.

Copy link
Contributor

@ramereth ramereth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@khashf just take off the .x86_64 at the end as it's not needed.

test/integration/server/inspec/server_spec.rb Outdated Show resolved Hide resolved
test/integration/server/inspec/server_spec.rb Outdated Show resolved Hide resolved
@khashf khashf requested a review from ramereth May 16, 2019 04:31
test/integration/provisioning/destroy_all.rb Outdated Show resolved Hide resolved
test/integration/server/inspec/server_spec.rb Outdated Show resolved Hide resolved
test/integration/mon/inspec/mon_spec.rb Show resolved Hide resolved
test/integration/mon/inspec/mon_spec.rb Show resolved Hide resolved
test/integration/server/inspec/server_spec.rb Outdated Show resolved Hide resolved
@khashf khashf requested a review from ramereth May 16, 2019 22:32
@khashf khashf removed the WIP label May 16, 2019
@khashf
Copy link
Contributor Author

khashf commented May 21, 2019

Having some error with ini resource handling section & setting name with . character

What's inside

[centos@moncentos7-freefood-turquoise-zstuv3b ~]$ sudo cat /etc/munin/plugin-conf.d/mysql
[mysql*]
env.mysqluser monitor
env.mysqlpassword ToJzwUyqQmyV4GgMVpz0

InSpec test

describe ini('/etc/munin/plugin-conf.d/mysql') do
  its(['mysql*', 'env.mysqluser']) { should eq 'monitor' }
  its(['mysql*', 'env.mysqlpassword']) { should eq 'ToJzwUyqQmyV4GgMVpz0' }
end

Test error

  INI /etc/munin/plugin-conf.d/mysql
     ∅  ["mysql*", "env.mysqluser"] should eq "monitor"
     
     expected: "monitor"
          got: nil
     
     (compared using ==)

     ∅  ["mysql*", "env.mysqlpassword"] should eq "ToJzwUyqQmyV4GgMVpz0"
     
     expected: "ToJzwUyqQmyV4GgMVpz0"
          got: nil
     
     (compared using ==)

@khashf
Copy link
Contributor Author

khashf commented May 21, 2019

Resolved. The file /etc/munin/plugin-conf.d/mysql doesn't have = sign from setting name to its value, so the ini test certainly fails since it looks for the = delimiter to differentiate setting name and value. Thus, the only way is to keep the file resource with 2 matches to test this config. (The rest is fine with ini resource)

The init-style-formatted file doesn't really standard
@eldebrim
Copy link
Contributor

@ramereth Do we still need the serverspec gem in the Gemfile?

@ramereth
Copy link
Contributor

@eldebrim we don't use the Gemfile at all so it doesn't really matter if it's there or not

Copy link
Contributor

@ramereth ramereth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please merge as-is.

@khashf khashf merged commit b770efe into master May 22, 2019
@khashf khashf deleted the freefood/migrate_to_inspec branch May 22, 2019 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants