-
Notifications
You must be signed in to change notification settings - Fork 71
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 examples return errors #258
Comments
Fixed via #259 |
Any updates? |
I believe that these methods do work if the instance exists. Are you able to throw in a We use these in the integration tests which currently pass |
yes. I did. this_instance = google_compute_instance(project: gcp_project_id, zone: zone, name: vm_name)
describe this_instance do
it { should exist }
# wait up to 15 minutes if the Compute Engine instance is not yet ready
its('status', retry: 45, retry_wait: 20){should eq 'RUNNING'}
its('machine_type') { should match machine_type }
##[cut here]
### Below check doesn't work
its('first_network_interface_nat_ip_exists'){ should be false } We able to test that a GCP compute instance has a single public IP address, but we can't test that a GCP compute instance doesn't have a single public IP address that step:
please find the output when we have an external IP address:
please find the output when instance doesn't have an external IP address:
please find related .rb code here: https://github.com/inspec/inspec-gcp/blob/master/libraries/google_compute_instance.rb |
The reason is: def parse
@network_interfaces = GoogleInSpec::Compute::Property::InstanceNetworkInterfacesArray.parse(@fetched['networkInterfaces'], to_s)
[cut here]
def first_network_interface_nat_ip_exists
!@network_interfaces[0].access_configs[0].nat_ip.nil?
end According to Google API: So with first_network_interface_nat_ip_exists we cannot check that first_network_interface_nat_ip_exists doesn't; exist. |
So my question here: how can we check that VM instance doesn't have external IP? This is the most common variant to check. |
Loop through the
|
It doesn't work, got following:
|
Errr, try I mixed up my ruby methods |
Unfortunately still the same issue
|
from the
google_compute_instance
examplesreturns
Tried on profile version
1.0-1.5
Describe the problem
Possible Solution
The text was updated successfully, but these errors were encountered: