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

google_compute_instance_group: location symbol doesn't exist #21

Closed
darkn3rd opened this issue Jun 8, 2018 · 1 comment
Closed

google_compute_instance_group: location symbol doesn't exist #21

darkn3rd opened this issue Jun 8, 2018 · 1 comment
Assignees

Comments

@darkn3rd
Copy link

darkn3rd commented Jun 8, 2018

Description

The google_compute_instance_group example incorrectly documents location as a valid symbol. Also, if invalid symbol is used, get a cryptic message as the result.

Reproduce

PROJECT_NAME = attribute('project_name', description: 'gcp project name')
CLUSTER_ZONE = attribute('cluster_zone', default: 'us-east1-b', description: 'gcp cluster zone')

describe google_compute_instance_group(project: PROJECT_NAME, location: CLUSTER_ZONE, name: 'gke-guestbook-default-pool-d84d40bd-grp') do
    it { should exist }
    its('name') { should eq 'gke-guestbook-default-pool-d84d40bd-grp' }
    its('status') { should eq 'in_use' }
end

Actual Result

     ×  Control Source Code Error guestbook-profile/controls/cluster_test.rb:10
     765: unexpected token at 'Not Found'

Expect Result

If there was a bad symbol used, I would expect a message that states: Symbol location: not supported or something.

The example in the class documents this:

  class GoogleComputeInstanceGroup < GcpResourceBase
    name 'google_compute_instance_group'
    desc 'Verifies settings for a compute instance group'

    example "
      describe google_compute_instance_group(project: 'chef-inspec-gcp', location: 'us-west2', name: 'gcp-inspec-test') do
        it { should exist }
        its('name') { should eq 'inspec-test' }
        its('status') { should eq 'in_use' }
        ...
      end
    "

When the code expects zone. Interestingly, google uses the term location, but expects a zone, and the Inspec class supports zone.

@skpaterson skpaterson self-assigned this Jun 11, 2018
@skpaterson
Copy link

Documented example was again incorrect here, updating to correctly reflect zone rather than location:

describe google_compute_instance_group(project: 'chef-inspec-gcp', zone: 'europe-west2-a', name: 'gcp-inspec-test') do
...

skpaterson pushed a commit that referenced this issue Jun 11, 2018
* Ensure resources have consistent exists methods.
* Corrected a coupld of arguments in example doc strings.

Signed-off-by: Stuart Paterson <[email protected]>
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

No branches or pull requests

2 participants