k1LoW / awspec

RSpec tests for your AWS resources.
MIT License
1.17k stars 194 forks source link

About errors in testing in a different region #589

Open BFTnaito opened 4 months ago

BFTnaito commented 4 months ago

When I conducted tests using awspec, I got results like the following: In scenario ②, I made changes to [Changes in ①②], but it resulted in an [error]. Are there any other files that I should edit? Or could there be a different way to make the changes?

[Test Content] ① When testing a service in the same region as an EC2 instance with awspec installed, the test succeeds. ② When testing a service in a different region from the EC2 instance with awspec installed, the test fails.

[Changes in ①②]

File specifying the test target Test code (Ruby) for each resource type Variable definition file [Error] (in /awspec) /home/awspec/.rbenv/versions/3.3.0/bin/ruby -I/awspec/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.0/lib:/awspec/vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib /awspec/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.0/exe/rspec --pattern spec/check_ecs_cluster/*_spec.rb

[ecs_cluster_spec.rb] Run awspec to demo-cluster

An error occurred while loading ./spec/check_ecs_cluster/ecs_cluster_spec.rb. Failure/Error: properties[master_roll].each do |attr| describe ecs_cluster(attr['name']) do it { should exist }

csharp Copy code case attr['status'] when "be_active" it { should be_active } when "be_inactive" it { should be_inactive } else NoMethodError: undefined method `[]' for nil

./spec/check_ecs_cluster/ecs_cluster_spec.rb:15:in `<top (required)>'

No examples found.

Finished in 0.00005 seconds (files took 8.73 seconds to load) 0 examples, 0 failures, 1 error occurred outside of examples

BFTnaito commented 4 months ago

返信お願いします。

k1LoW commented 4 months ago

You can use shared_context: region https://github.com/k1LoW/awspec/tree/master?tab=readme-ov-file#using-shared_context-region