diff --git a/.dockerignore b/.dockerignore index b1f0e5d6fe69..684ae5d80c40 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1 @@ -.git -*.md -LICENSE \ No newline at end of file +!build \ No newline at end of file diff --git a/.dockerignore.Dockerfile.server-test b/.dockerignore.Dockerfile.server-test deleted file mode 100644 index 0739e296e62c..000000000000 --- a/.dockerignore.Dockerfile.server-test +++ /dev/null @@ -1,3 +0,0 @@ -build -LICENSE -**/.git \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b2b388a42a98..a285948cbfd7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/Dockerfile.server-test b/Dockerfile.server-test deleted file mode 100644 index 9118318a59fb..000000000000 --- a/Dockerfile.server-test +++ /dev/null @@ -1,38 +0,0 @@ -FROM ubuntu as func-e-downloader - -RUN apt update && apt -y install curl - -RUN curl https://func-e.io/install.sh | bash -s -- -b /usr/local/bin - -FROM tinygo/tinygo as build-stage - -RUN apt-get install -y build-essential curl - -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y - -RUN ~/.cargo/bin/cargo install wasm-tools - -WORKDIR /usr/src/wasm-filter - -COPY coraza coraza -COPY go.mod go.mod -COPY go.sum go.sum - -RUN go mod download - -COPY main.go main.go -COPY Makefile Makefile - -RUN make build - -RUN ~/.cargo/bin/wasm-tools validate build/main.wasm -RUN ~/.cargo/bin/wasm-tools dump build/main.wasm > build/main.wasm.dump - -FROM func-e-downloader as run-stage - -WORKDIR /usr/bin/wasm-filter - -COPY --from=build-stage /usr/src/wasm-filter/build ./build -COPY e2e/envoy-config.yaml envoy-config.yaml - -ENTRYPOINT ["/usr/local/bin/func-e", "run", "-c envoy-config.yaml", "--log-level info", "--component-log-level wasm:debug"] diff --git a/Makefile b/Makefile index edc847586010..7617ad4c9ba3 100644 --- a/Makefile +++ b/Makefile @@ -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) \ No newline at end of file diff --git a/e2e/docker-compose.yml b/e2e/docker-compose.yml new file mode 100644 index 000000000000..fd36e9b898b8 --- /dev/null +++ b/e2e/docker-compose.yml @@ -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 diff --git a/e2e/tests.sh b/e2e/tests.sh index d5a3f4b87873..6e41644073d4 100755 --- a/e2e/tests.sh +++ b/e2e/tests.sh @@ -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"