This repository has been archived by the owner on Dec 26, 2023. It is now read-only.
pass layer names as lf_names input object variable #40
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: E2E Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
LF_TELEMETRY_DISABLED: "1" | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.4.6 | |
terraform_wrapper: false | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: stable | |
- run: go install . | |
- name: layerform config set-context | |
run: | | |
# validations, fails if command succeeds | |
! layerform config set-context test -t local # missing --dir | |
! layerform config set-context test -t s3 --bucket bucket # missing region | |
! layerform config set-context test -t s3 --region region # missing bucket | |
! layerform config set-context test -t cloud --url "invalid url" --email [email protected] --password strongpass | |
! layerform config set-context test -t cloud --url https://a.b.com --email invalid --password strongpass | |
! layerform config set-context test -t cloud --email invalid --password strongpass # missing url | |
! layerform config set-context test -t cloud --url https://a.b.com --password strongpass # missing email | |
! layerform config set-context test -t cloud --url https://a.b.com --email [email protected] # missing password | |
# set valid contexts | |
layerform config set-context test-s3 -t s3 --bucket bucket --region us-east-1 | |
layerform config set-context test-cloud -t cloud --url https://demo.layerform.dev --email [email protected] --password strongpass | |
layerform config set-context test-local -t local --dir test | |
- name: Configure | |
run: | | |
layerform configure --file examples/local/layerform.json | |
- name: List definitions | |
run: | | |
layerform list definitions | tee definitions | |
grep -E 'foo' definitions | |
grep -E 'bar\s+foo' definitions | |
grep -E 'baz\s+foo' definitions | |
- name: List instances | |
run: | | |
layerform list instances | tee instances | |
grep 'No layer instances spawned' instances | |
- name: Spawn instances | |
run: | | |
layerform spawn bar test_bar | |
layerform spawn baz test_baz | |
layerform spawn bar test_custom_foo --base foo=custom | |
layerform list instances | tee instances | |
grep -E 'default\s+foo\s+alive' instances | |
grep -E 'test_bar\s+bar\s+foo=default\s+alive' instances | |
grep -E 'test_baz\s+baz\s+foo=default\s+alive' instances | |
grep -E 'custom\s+foo\s+alive' instances | |
grep -E 'test_custom_foo\s+bar\s+foo=custom\s+alive' instances | |
- name: Output | |
run: | | |
layerform output bar test_bar | jq .bar_file.value | tee output | |
grep -E '\.layerform\/examples\/local\/foo-default\/bar-test_bar\.txt' output | |
layerform output bar test_bar | jq .foo_file.value | tee output | |
grep -E '\.layerform\/examples\/local\/foo-default\/\.keep' output | |
- name: Refresh | |
run: | | |
layerform refresh bar test_bar --var prefix=test-prefix- | |
layerform output bar test_bar | jq .bar_file.value | tee output | |
grep -E '\.layerform\/examples\/local\/test-prefix-foo-default\/bar-test_bar\.txt' output | |
layerform refresh bar test_bar | |
- name: Can't kill instance that has dependants | |
run: | | |
# fails if kill succeeds | |
! layerform kill foo default | |
- name: Kill instance | |
run: | | |
yes yes | layerform kill bar test_bar | |
layerform list instances | tee instances | |
# fails if instance is still there | |
! grep -E 'test_bar\s+bar\s+foo=default\s+alive' instances | |
- name: Can't spawn instance with invalid name | |
run: | | |
# fails if spawn succeeds | |
! layerform spawn foo 'this has spaces' | |
! layerform spawn foo 'this#has%special&chars' | |
! layerform spawn foo '_cant-start-with-underscore' | |
! layerform spawn foo 'cant-end-with-underscore_' | |
! layerform spawn foo 'cant-end-with-dash-' |