Circle 2 localstack support?

docker

#1

According to this post, it is impossible to share a network between the remote docker and the build container (i.e., the host).

So how can I launch a localstack, connect to it from the host and run tests on the host against localstack?

An example is that I have a DAO object that needs a DynamoDB backend to be tested. I want to launch the DynamoDB in localstack, and run the DAO tests in the build container (the host).


#2

Run it in the machine executor.


#3

Yep, it seems to be the only way


#4

We do this without running the machine executor, by having a localstack docker image specified and referencing localhost

tests:
docker:
- image: circleci/node:8
environment:
AWS_DYNAMODB_ENDPOINT: http://localhost:4569
AWS_DEFAULT_REGION: us-west-2
AWS_REGION: us-west-2
TZ: “/usr/share/zoneinfo/America/Los_Angeles”
- image: localstack/localstack
environment:
DEBUG: 1
SERVICES: dynamodb,dynamodbstreams,kinesis
DATA_DIR: /tmp/localstack/data
working_directory: ~/workflows
steps:
- *generate_git_sha
- *restore_git_repo
- restore_cache:
keys:
- node-modules-{{ checksum “yarn.lock” }}
- run:
name: Setup AWS
command: |
set -e
NODE_ENV=test yarn run create_dyn_tables
- run:
name: ES health check
command: elasticsearch/block_until_healthy.sh
- run:
name: Setup ES indices
command: |
NODE_ENV=test elasticsearch/create_es_indices.sh
- run:
name: Run Node Tests
command: yarn test – --coverage


#5

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.