Skip to content

Commit

Permalink
tests: stop using stacker_blueprints in functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkza committed Mar 20, 2019
1 parent b43492e commit 02a797e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
10 changes: 10 additions & 0 deletions tests/fixtures/blueprints/bucket.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
AWSTemplateFormatVersion: 2010-09-09
Resources:
Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: {{ variables.BucketName }}
AccessControl: Private
Outputs:
BucketName:
Value: !Ref Bucket
32 changes: 15 additions & 17 deletions tests/test_suite/34_stacker_build-integrated-hooks.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ load ../test_helper
needs_aws

config() {
echo "namespace: ${STACKER_NAMESPACE}"
echo "namespace: ${STACKER_NAMESPACE}-integrated-hooks"
cat <<'EOF'
stacks:
- name: buckets
- name: bucket
profile: stacker
class_path: stacker_blueprints.s3.Buckets
template_path: fixtures/blueprints/bucket.yaml.j2
variables:
Buckets:
StackerTestBucket:
BucketName: "stacker-${envvar STACKER_NAMESPACE}-integrated-hooks-${awsparam AccountId}"
BucketName: "stacker-${envvar STACKER_NAMESPACE}-integrated-hooks-${awsparam AccountId}"
build_hooks:
- name: write-hello
Expand All @@ -38,7 +36,7 @@ build_hooks:
command: 'aws s3 cp /tmp/hello.txt "s3://$BUCKET/hello.txt"'
shell: true
env:
BUCKET: "${output buckets::StackerTestBucketBucketId}"
BUCKET: "${output bucket::BucketName}"
AWS_PROFILE: stacker
- name: send-world
Expand All @@ -49,7 +47,7 @@ build_hooks:
command: 'aws s3 cp "s3://$BUCKET/hello.txt" "s3://$BUCKET/world.txt"'
shell: true
env:
BUCKET: "${output buckets::StackerTestBucketBucketId}"
BUCKET: "${output bucket::BucketName}"
AWS_PROFILE: stacker
destroy_hooks:
Expand All @@ -59,7 +57,7 @@ destroy_hooks:
command: 'aws s3 rm "s3://$BUCKET/world.txt"'
shell: true
env:
BUCKET: "${output buckets::StackerTestBucketBucketId}"
BUCKET: "${output bucket::BucketName}"
AWS_PROFILE: stacker
- name: remove-hello
Expand All @@ -70,13 +68,13 @@ destroy_hooks:
command: 'aws s3 rm "s3://$BUCKET/hello.txt"'
shell: true
env:
BUCKET: "${output buckets::StackerTestBucketBucketId}"
BUCKET: "${output bucket::BucketName}"
AWS_PROFILE: stacker
- name: clean-hello
path: stacker.hooks.command.run_command
required_by:
- buckets
- bucket
args:
command: [rm, -f, /tmp/hello.txt]
EOF
Expand All @@ -86,14 +84,14 @@ EOF
stacker destroy --force <(config)
}

stacker build <(config)
stacker build -t --recreate-failed <(config)
assert "$status" -eq 0
assert_has_line "Using default AWS provider mode"
assert_has_lines_in_order -E <<'EOF'
pre_build_hooks: complete
write-hello: complete
buckets: submitted \(creating new stack\)
buckets: complete \(creating new stack\)
bucket: submitted \(creating new stack\)
bucket: complete \(creating new stack\)
upload: [^ ]*/hello.txt to s3://[^ ]*/hello.txt
send-hello: complete
copy: s3://[^ ]*/hello.txt to s3://[^ ]*/world.txt
Expand All @@ -110,8 +108,8 @@ delete: s3://[^ ]*/world.txt
remove-world: complete
delete: s3://[^ ]*/hello.txt
remove-hello: complete
buckets: submitted \(submitted for destruction\)
buckets: complete \(stack destroyed\)
bucket: submitted \(submitted for destruction\)
bucket: complete \(stack destroyed\)
clean-hello: complete
post_destroy_hooks: complete
EOF
Expand All @@ -125,7 +123,7 @@ EOF
pre_destroy_hooks: complete
remove-world: skipped
remove-hello: skipped
buckets: skipped
bucket: skipped
clean-hello: complete
post_destroy_hooks: complete
EOF
Expand Down

0 comments on commit 02a797e

Please sign in to comment.