|
29 | 29 | cache: true
|
30 | 30 | - run: make test
|
31 | 31 |
|
| 32 | + integration: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + services: |
| 35 | + consul: |
| 36 | + image: hashicorp/consul |
| 37 | + ports: |
| 38 | + - 8500:8500 |
| 39 | + vault: |
| 40 | + image: hashicorp/vault |
| 41 | + env: |
| 42 | + SKIP_SETCAP: "true" |
| 43 | + VAULT_DEV_ROOT_TOKEN_ID: vault-auth-token |
| 44 | + ports: |
| 45 | + - 8200:8200 |
| 46 | + env: |
| 47 | + SERVICE_NAME: my-test-service |
| 48 | + SERVICE_PRODUCT: test |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v4 |
| 51 | + - uses: actions/setup-go@v5 |
| 52 | + with: |
| 53 | + go-version-file: go.mod |
| 54 | + check-latest: true |
| 55 | + cache: true |
| 56 | + - name: Setup |
| 57 | + run: | |
| 58 | + source tests/setup |
| 59 | +
|
| 60 | + consul global/env_vars/FOO foo |
| 61 | + consul global/env_vars/BAR bar |
| 62 | + consul global/dev/env_vars/DEV dev |
| 63 | + consul services/my-test-service/env_vars/FOO foobar |
| 64 | + consul services/my-test-service/env_vars/BAZ baz |
| 65 | + consul services/my-test-service/dev/env_vars/FOOBAR test |
| 66 | +
|
| 67 | + vault global/env_vars/SECRET my-secret |
| 68 | + vault global/dev/env_vars/SECRET my-dev-secret |
| 69 | + vault global/dev/env_vars/DEV vdev |
| 70 | + vault services/my-test-service/env_vars/FOO vfoo |
| 71 | + vault services/my-test-service/dev/env_vars/FOOBAR vfoobar |
| 72 | + - name: Test no config |
| 73 | + run: scripts/test -s 0 -e tests/no-config.stderr.txt true |
| 74 | + - name: Test no command |
| 75 | + run: scripts/test -s 1 -e tests/no-command.stderr.txt |
| 76 | + - name: Test load all dev |
| 77 | + run: scripts/test -s 0 -o tests/dev.stdout.txt -e tests/dev.stderr.txt tests/print-env FOO BAR BAZ DEV TEST SECRET |
| 78 | + env: |
| 79 | + CONSUL_ADDR: http://127.0.0.1:8500 |
| 80 | + VAULT_ADDR: http://127.0.0.1:8200 |
| 81 | + VAULT_TOKEN: vault-auth-token |
| 82 | + - name: Test load all |
| 83 | + run: scripts/test -s 0 -o tests/full.stdout.txt tests/print-env FOO BAR BAZ DEV TEST SECRET |
| 84 | + env: |
| 85 | + CONSUL_ADDR: http://127.0.0.1:8500 |
| 86 | + VAULT_ADDR: http://127.0.0.1:8200 |
| 87 | + VAULT_TOKEN: vault-auth-token |
| 88 | + SERVICE_ENV: stage |
| 89 | + - name: Test load consul |
| 90 | + run: scripts/test -s 0 -o tests/consul.stdout.txt -e tests/consul.stderr.txt tests/print-env FOO BAR BAZ DEV TEST |
| 91 | + env: |
| 92 | + CONSUL_ADDR: http://127.0.0.1:8500 |
| 93 | + - name: Test load vault |
| 94 | + run: scripts/test -s 0 -o tests/vault.stdout.txt -e tests/vault.stderr.txt tests/print-env FOO BAR BAZ DEV TEST SECRET |
| 95 | + env: |
| 96 | + VAULT_ADDR: http://127.0.0.1:8200 |
| 97 | + VAULT_TOKEN: vault-auth-token |
| 98 | + SERVICE_ENV: stage |
| 99 | + - name: Test load no service |
| 100 | + run: scripts/test -d -s 0 -o tests/no-service.stdout.txt -e tests/no-service.stderr.txt tests/print-env FOO BAR BAZ DEV TEST SECRET |
| 101 | + env: |
| 102 | + SERVICE_NAME: "" |
| 103 | + CONSUL_ADDR: http://127.0.0.1:8500 |
| 104 | + VAULT_ADDR: http://127.0.0.1:8200 |
| 105 | + VAULT_TOKEN: vault-auth-token |
| 106 | + SERVICE_ENV: stage |
| 107 | + |
32 | 108 | shellcheck:
|
33 | 109 | runs-on: ubuntu-latest
|
34 | 110 | steps:
|
|
0 commit comments