Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit ab1ebb8

Browse files
authored
Refactor e2e tests (#100)
1 parent cb098f4 commit ab1ebb8

File tree

10 files changed

+192
-135
lines changed

10 files changed

+192
-135
lines changed

.github/workflows/workflow.yaml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ jobs:
3737
- name: checkout
3838
uses: actions/checkout@v2
3939

40-
- name: build examples
41-
run: find ./examples -type f -name "main.go" | xargs -Ip tinygo build -o p.wasm -scheduler=none -target=wasi -wasm-abi=generic p
42-
43-
- name: upload wasm-binaries
44-
uses: actions/upload-artifact@v2
40+
- name: cache built examples
41+
uses: actions/cache@v2
42+
id: cache-built-examples
4543
with:
46-
name: wasm-binaries
4744
path: examples
45+
key: ${{ hashFiles('examples/**', 'proxywasm/**') }}
46+
47+
- name: build examples
48+
if: steps.cache-built-examples.outputs.cache-hit != 'true'
49+
run: find ./examples -type f -name "main.go" | xargs -Ip tinygo build -o p.wasm -scheduler=none -target=wasi -wasm-abi=generic p
4850

4951
e2e-tests-envoy:
5052
strategy:
@@ -59,11 +61,11 @@ jobs:
5961
- name: checkout
6062
uses: actions/checkout@v2
6163

62-
- name: download wasm-binaries
63-
uses: actions/download-artifact@v2
64+
- name: cache built examples
65+
uses: actions/cache@v2
6466
with:
65-
name: wasm-binaries
6667
path: examples
68+
key: ${{ hashFiles('examples/**', 'proxywasm/**') }}
6769

6870
- name: set up go 1.15
6971
uses: actions/setup-go@v1
@@ -81,16 +83,21 @@ jobs:
8183
needs: build-examples
8284
runs-on: ubuntu-latest
8385
container:
84-
image: getenvoy/proxy-wasm-go-sdk-ci:istio-${{ matrix.istio-version }}
86+
image: istio/proxyv2:${{ matrix.istio-version }}
8587
steps:
8688
- name: checkout
8789
uses: actions/checkout@v2
8890

89-
- name: download wasm-binaries
90-
uses: actions/download-artifact@v2
91+
- name: set up go 1.15
92+
uses: actions/setup-go@v1
93+
with:
94+
go-version: 1.15
95+
96+
- name: fetch built examples
97+
uses: actions/cache@v2
9198
with:
92-
name: wasm-binaries
9399
path: examples
100+
key: ${{ hashFiles('examples/**', 'proxywasm/**') }}
94101

95102
- name: run e2e test
96-
run: go test ./e2e/... -v
103+
run: CGO_ENABLED=0 go test ./e2e/... -v

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
.DEFAULT_GOAL := build.examples
22

3-
ISTIO_VERSION ?= 1.7.3
4-
53
.PHONY: build.example build.example.docker build.examples build.examples.docker lint test test.sdk test.e2e
64

75
build.example:
@@ -26,10 +24,10 @@ test:
2624
go test -tags=proxytest $(shell go list ./... | grep -v e2e | sed 's/github.com\/tetratelabs\/proxy-wasm-go-sdk/./g')
2725

2826
test.e2e:
29-
docker run -it -w /tmp/proxy-wasm-go -v $(shell pwd):/tmp/proxy-wasm-go getenvoy/proxy-wasm-go-sdk-ci:istio-${ISTIO_VERSION} go test -v ./e2e
27+
go test -v ./e2e
3028

3129
test.e2e.single:
32-
docker run -it -w /tmp/proxy-wasm-go -v $(shell pwd):/tmp/proxy-wasm-go getenvoy/proxy-wasm-go-sdk-ci:istio-${ISTIO_VERSION} go test -v ./e2e -run ${name}
30+
go test -v ./e2e -run ${name}
3331

3432
run:
3533
docker run --entrypoint='/usr/local/bin/envoy' \

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ make run name=helloworld
7171
```bash
7272
make test # run local tests without running envoy processes
7373

74+
## requires you to have the Envoy binary locally
7475
make test.e2e # run e2e tests
76+
77+
## requires you to have the Envoy binary locally
78+
make test.e2e.single name=helloworld # run e2e tests
7579
```
7680

7781
## limitations and considerations

e2e/Dockerfile

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)