Skip to content

Commit 13dced1

Browse files
committed
fix(ci): pass LocalStack auth token to Testcontainers
1 parent 829dac0 commit 13dced1

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,19 @@ jobs:
8181
run: |
8282
localstack logs
8383
84-
- name: Ensure Docker is available for Testcontainers
84+
- name: Stop LocalStack
8585
run: |
86-
sudo systemctl start docker || true
87-
docker version
88-
docker info
86+
localstack stop
8987
9088
- name: Run Testcontainers tests
9189
env:
9290
AWS_ACCESS_KEY_ID: test
9391
AWS_SECRET_ACCESS_KEY: test
9492
AWS_REGION: us-east-1
95-
DOCKER_HOST: unix:///var/run/docker.sock
93+
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
9694
run: |
9795
mvn test -Dtest=dev.ancaghenade.shipmentlistdemo.integrationtests.ShipmentServiceIntegrationTest
9896
99-
- name: Stop LocalStack
100-
if: always()
101-
run: |
102-
localstack stop
103-
10497
- name: Send a Slack notification
10598
if: failure() || github.event_name != 'pull_request'
10699
uses: ravsamhq/notify-slack-action@v2

src/test/java/dev/ancaghenade/shipmentlistdemo/integrationtests/LocalStackSetupConfigurations.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,14 @@
6565
@Testcontainers
6666
@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
6767
public class LocalStackSetupConfigurations {
68+
private static final String LOCALSTACK_AUTH_TOKEN = System.getenv().getOrDefault(
69+
"LOCALSTACK_AUTH_TOKEN", "");
6870

6971
@Container
7072
protected static LocalStackContainer localStack =
7173
new LocalStackContainer(DockerImageName.parse("localstack/localstack:latest"))
7274
.withEnv("LOCALSTACK_HOST", "localhost.localstack.cloud")
75+
.withEnv("LOCALSTACK_AUTH_TOKEN", LOCALSTACK_AUTH_TOKEN)
7376
.withEnv("LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT", "60")
7477
.withEnv("DEBUG", "1");
7578

0 commit comments

Comments
 (0)