lib/templates/stack/test/spec/main_spec.rb.tt in rspec-terraspace-0.2.3 vs lib/templates/stack/test/spec/main_spec.rb.tt in rspec-terraspace-0.3.0
- old
+ new
@@ -1,19 +1,18 @@
describe "main" do
before(:all) do
- reconfigure_logging # reconfigure Terraspace.logger to a file
stack_path = File.expand_path("../..", __dir__) # the source of the stack to test is 2 levels up
ts_root = File.expand_path("../../..", stack_path) # original Terraspace.root
# Build terraspace project to use as a test harness
# Will be located at: /tmp/terraspace/test-harnesses/<%= name %>-harness
terraspace.build_test_harness(
name: "<%= name %>-harness",
modules: "#{ts_root}/app/modules", # include all modules in folder
stacks: {<%= name %>: stack_path},
# override demo stack tfvars for testing
- tfvars: {demo: "#{stack_path}/test/spec/fixtures/tfvars/demo.tfvars"},
config: "#{stack_path}/test/spec/fixtures/config",
+ # tfvars: {demo: "#{stack_path}/test/spec/fixtures/tfvars/test.tfvars"},
)
terraspace.up("<%= name %>")
end
after(:all) do
terraspace.down("<%= name %>")
@@ -22,9 +21,13 @@
it "successful deploy" do
# Replace with your own test
expect(true).to be true
# Example
# pp terraspace.outputs
- # output_value = terraspace.output("<%= name %>", "some-output")
- # expect(output_value).to include("some-value")
+ output_value = terraspace.output("<%= name %>", "bucket_name")
+ puts "output_value #{output_value}"
+ # More useful helpers:
+ # pp terraspace.state['resources']
+ # pp terraspace.state_resource('random_pet.this')
+ # pp terraspace.state_resource('module.bucket')
end
end