Skip to content

Commit

Permalink
Use docker-compose for e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraaga committed Aug 17, 2022
1 parent 36e07ac commit 9d2e777
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 73 deletions.
4 changes: 1 addition & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
.git
*.md
LICENSE
!build
3 changes: 0 additions & 3 deletions .dockerignore.Dockerfile.server-test

This file was deleted.

18 changes: 4 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,15 @@ jobs:
restore-keys: |
${{ runner.os }}-tinygo-
- name: Run tests
- name: Run unit tests
run: make test

- name: Build WASM filter
run: make build

- name: "Install func-e"
shell: bash
run: curl https://func-e.io/install.sh | bash -s -- -b /usr/local/bin

- name: "Spin up server and envoy"
shell: bash
run: |
func-e run -c e2e/envoy-config.yaml --log-level info --component-log-level wasm:debug &
- name: "Run tests"
shell: bash
run: |
./e2e/tests.sh
- name: Run e2e tests
working-directory: e2e
run: docker-compose up --abort-on-container-exit

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down
38 changes: 0 additions & 38 deletions Dockerfile.server-test

This file was deleted.

12 changes: 0 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,3 @@ build:

test:
go test -tags="proxytest" ./...

server-test-build:
docker build --progress=plain -t $(IMAGE_NAME) -f Dockerfile.server-test .

server-test-wasm-dump: server-test-build
@docker rm -f $(CONTAINER_NAME) || true
@docker create -ti --name $(CONTAINER_NAME) $(IMAGE_NAME) bash
docker cp $(CONTAINER_NAME):/usr/bin/wasm-filter/build ./
@docker rm -f $(CONTAINER_NAME)

server-test-run: server-test-build
docker run -p 8001:8001 $(IMAGE_NAME)
25 changes: 25 additions & 0 deletions e2e/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
services:
envoy:
image: envoyproxy/envoy:v1.22-latest
command:
- -c
- /conf/envoy-config.yaml
- --log-level
- info
- --component-log-level
- wasm:debug
volumes:
- ../build:/build
- .:/conf
ports:
- 8001:8001
tests:
depends_on:
- envoy
image: curlimages/curl
entrypoint: sh
command:
- /conf/tests.sh
- envoy
volumes:
- .:/conf
7 changes: 4 additions & 3 deletions e2e/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
step=1
total_steps=3
max_retries=10 #seconds for the server reachability timeout
health_url="http://localhost:8001"
unfiltered_url="http://localhost:8001/home"
filtered_url="http://localhost:8001/admin"
host=${1:-localhost}
health_url="http://${host}:8001"
unfiltered_url="http://${host}:8001/home"
filtered_url="http://${host}:8001/admin"

# Testing if the server is up
echo "[$step/$total_steps] Testing application reachability"
Expand Down

0 comments on commit 9d2e777

Please sign in to comment.