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

Restructured Integration Testing Suite using InSpec Profile #78

Merged
merged 9 commits into from
Mar 26, 2018

Conversation

americanhanko
Copy link
Collaborator

This PR

  • Converts the chef generate cookbook smoke test layout into an InSpec profile layout, created by inspec init profile.
  • Breaks up each of the InSpec tests into control groups that make a little more sense (e.g. admin-user vs. standard-user controls)

Why

  • I feel this is a better design for a testing suite that allows the easy re-use of InSpec controls.
  • With an InSpec profile, there is potential for reusability for other macOS admins/ops personnel.

Takeaways

  • The controls are named and organized according to System Preferences.app. Although this structure feels purposeful and familiar, it may need to be revisited if it is too consumer forward rather than administrator forward.
  • Significantly more test coverage is required for things like preferences and each of their domain scopes. To combat this, I hope to add some high-level functionality via the use of attributes or recipes that will make the resources of the cookbook more useful for less technical users

.kitchen.yml Outdated
@@ -4,79 +4,72 @@ driver:
provider: parallels

provisioner:
product_name: chef
product_version: 13.8
name: chef_zero
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should still be forcing the latest chef-client here, instead of what might be in a testing box.

Copy link
Contributor

Choose a reason for hiding this comment

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

provisioner:
  product_name: chef
  product_version: latest
  install_strategy: always

.kitchen.yml Outdated
- recipe[macos_test::spotlight]
verifier:
controls:
- indexing/searching
Copy link
Contributor

Choose a reason for hiding this comment

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

These slashes make me thing there's some sort of namespacing happening at first glance - may just indexing_and_seaching?

.kitchen.yml Outdated
- recipe[macos_test::xcode]
verifier:
controls:
- xcode/simulators
Copy link
Contributor

Choose a reason for hiding this comment

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

These slashes make me thing there's some sort of namespacing happening at first glance - may just xcode_and_simulators?

# macOS Cookbook InSpec Profile

The macOS Cookbook InSpec profile tests the custom resources and the recipes
that utilize them to assertain their full functionality and dependability. We
Copy link
Contributor

Choose a reason for hiding this comment

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

*ascertain

@@ -0,0 +1,35 @@
title 'desktop & screen saver'
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer and over &.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why I wrote it with the ampersand:

screenshot 2018-03-24 15 43 19


describe command('systemsetup -getremoteappleevents') do
apple_events_pattern = Regexp.union('Remote Apple Events: On')
its('stdout') { should match apple_events_pattern }
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the include matcher to write this more simply.

its('stdout') { should include 'Remote Apple Events: On' }

end

describe command('/opt/chef/embedded/bin/xcversion simulators') do
sim_pattern = Regexp.union 'iOS 10.3.1 Simulator (installed)'
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using the include matcher here as well.

end

describe command('/opt/chef/embedded/bin/xcversion simulators') do
sim_pattern = Regexp.union 'iOS 9.3 Simulator (installed)'
Copy link
Contributor

Choose a reason for hiding this comment

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

And here.

@americanhanko americanhanko merged commit 984719a into release/1.10 Mar 26, 2018
@americanhanko americanhanko deleted the feature/inspec-profile branch March 26, 2018 16:36
@americanhanko americanhanko mentioned this pull request Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants