mirror of https://github.com/knative/func.git
chore: coverage for e2e tests (#1603)
* chore: coverage for e2e tests Signed-off-by: Matej Vasek <mvasek@redhat.com> * fixup: disable thread sanitiser Signed-off-by: Matej Vasek <mvasek@redhat.com> --------- Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
parent
fa3286ccac
commit
9a9da1ff3f
|
@ -7,7 +7,7 @@ jobs:
|
||||||
name: On Cluster RT Test
|
name: On Cluster RT Test
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go: [1.18.x]
|
go: [1.20.x]
|
||||||
os: ["ubuntu-latest"]
|
os: ["ubuntu-latest"]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -29,4 +29,8 @@ jobs:
|
||||||
- name: E2E On Cluster Test (Runtimes)
|
- name: E2E On Cluster Test (Runtimes)
|
||||||
env:
|
env:
|
||||||
TEST_TAGS: runtime
|
TEST_TAGS: runtime
|
||||||
run: make && make test-e2e-on-cluster
|
run: make test-e2e-on-cluster
|
||||||
|
- uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
files: ./coverage.txt
|
||||||
|
flags: e2e-test-oncluster-runtime
|
||||||
|
|
|
@ -7,7 +7,7 @@ jobs:
|
||||||
name: On Cluster Test
|
name: On Cluster Test
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go: [1.18.x]
|
go: [1.20.x]
|
||||||
os: ["ubuntu-latest"]
|
os: ["ubuntu-latest"]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -29,4 +29,8 @@ jobs:
|
||||||
- name: E2E On Cluster Test
|
- name: E2E On Cluster Test
|
||||||
env:
|
env:
|
||||||
E2E_RUNTIMES: ""
|
E2E_RUNTIMES: ""
|
||||||
run: make && make test-e2e-on-cluster
|
run: make test-e2e-on-cluster
|
||||||
|
- uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
files: ./coverage.txt
|
||||||
|
flags: e2e-test-oncluster
|
||||||
|
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.x
|
go-version: 1.20.x
|
||||||
- name: Install Binaries
|
- name: Install Binaries
|
||||||
run: ./hack/binaries.sh
|
run: ./hack/binaries.sh
|
||||||
- name: Allocate Cluster
|
- name: Allocate Cluster
|
||||||
|
@ -28,3 +28,7 @@ jobs:
|
||||||
run: make
|
run: make
|
||||||
- name: E2E runtime for ${{ matrix.runtime }}
|
- name: E2E runtime for ${{ matrix.runtime }}
|
||||||
run: make test-e2e-runtime runtime=${{ matrix.runtime }}
|
run: make test-e2e-runtime runtime=${{ matrix.runtime }}
|
||||||
|
- uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
files: ./coverage.txt
|
||||||
|
flags: e2e-test-runtime-${{ matrix.runtime }}
|
||||||
|
|
|
@ -7,7 +7,7 @@ jobs:
|
||||||
name: E2E Test
|
name: E2E Test
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go: [1.18.x]
|
go: [1.20.x]
|
||||||
os: ["ubuntu-latest"]
|
os: ["ubuntu-latest"]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -22,4 +22,8 @@ jobs:
|
||||||
- name: Local Registry
|
- name: Local Registry
|
||||||
run: ./hack/registry.sh
|
run: ./hack/registry.sh
|
||||||
- name: E2E Test
|
- name: E2E Test
|
||||||
run: make && make test-e2e
|
run: make test-e2e
|
||||||
|
- uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
files: ./coverage.txt
|
||||||
|
flags: e2e-test
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
/templates/typescript/http/build
|
/templates/typescript/http/build
|
||||||
/coverage.out
|
/coverage.out
|
||||||
/coverage.txt
|
/coverage.txt
|
||||||
|
/.coverage
|
||||||
/bin
|
/bin
|
||||||
/target
|
/target
|
||||||
|
|
||||||
|
|
11
Makefile
11
Makefile
|
@ -144,14 +144,19 @@ test-typescript: ## Test Typescript templates
|
||||||
test-integration: ## Run integration tests using an available cluster.
|
test-integration: ## Run integration tests using an available cluster.
|
||||||
go test -tags integration -timeout 30m --coverprofile=coverage.txt ./... -v
|
go test -tags integration -timeout 30m --coverprofile=coverage.txt ./... -v
|
||||||
|
|
||||||
test-e2e: ## Run end-to-end tests using an available cluster.
|
.PHONY: func-instrumented
|
||||||
|
|
||||||
|
func-instrumented: ## Func binary that is instrumented for e2e tests
|
||||||
|
env CGO_ENABLED=1 go build -ldflags $(LDFLAGS) -cover -o func ./cmd/func
|
||||||
|
|
||||||
|
test-e2e: func-instrumented ## Run end-to-end tests using an available cluster.
|
||||||
./test/e2e_lifecycle_tests.sh node
|
./test/e2e_lifecycle_tests.sh node
|
||||||
./test/e2e_extended_tests.sh
|
./test/e2e_extended_tests.sh
|
||||||
|
|
||||||
test-e2e-runtime: ## Run end-to-end lifecycle tests using an available cluster for a single runtime.
|
test-e2e-runtime: func-instrumented ## Run end-to-end lifecycle tests using an available cluster for a single runtime.
|
||||||
./test/e2e_lifecycle_tests.sh $(runtime)
|
./test/e2e_lifecycle_tests.sh $(runtime)
|
||||||
|
|
||||||
test-e2e-on-cluster: ## Run end-to-end on-cluster build tests using an available cluster.
|
test-e2e-on-cluster: func-instrumented ## Run end-to-end on-cluster build tests using an available cluster.
|
||||||
./test/e2e_oncluster_tests.sh
|
./test/e2e_oncluster_tests.sh
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
|
|
@ -31,9 +31,10 @@ set -o pipefail
|
||||||
|
|
||||||
use_kn_func=${E2E_USE_KN_FUNC:-}
|
use_kn_func=${E2E_USE_KN_FUNC:-}
|
||||||
|
|
||||||
curdir=$(pwd)
|
pushd "$(dirname "$0")/.."
|
||||||
cd $(dirname $0)
|
mkdir -p .coverage
|
||||||
cd ../
|
GOCOVERDIR="$(pwd)/.coverage"
|
||||||
|
export GOCOVERDIR
|
||||||
|
|
||||||
# Make sure 'func' binary is built in case KN FUNC was not required for testing
|
# Make sure 'func' binary is built in case KN FUNC was not required for testing
|
||||||
if [[ ! -f func && "$use_kn_func" != "true" ]]; then
|
if [[ ! -f func && "$use_kn_func" != "true" ]]; then
|
||||||
|
@ -47,5 +48,6 @@ go clean -testcache
|
||||||
go test -v -test.v -tags="e2e" ./test/e2e/
|
go test -v -test.v -tags="e2e" ./test/e2e/
|
||||||
ret=$?
|
ret=$?
|
||||||
|
|
||||||
cd $curdir
|
go tool covdata textfmt -i=./.coverage -o coverage.txt
|
||||||
|
popd
|
||||||
exit $ret
|
exit $ret
|
||||||
|
|
|
@ -37,9 +37,10 @@ set -o pipefail
|
||||||
runtime=${1:-}
|
runtime=${1:-}
|
||||||
use_kn_func=${E2E_USE_KN_FUNC:-}
|
use_kn_func=${E2E_USE_KN_FUNC:-}
|
||||||
|
|
||||||
curdir=$(pwd)
|
pushd "$(dirname "$0")/.."
|
||||||
cd $(dirname $0)
|
mkdir -p .coverage
|
||||||
cd ../
|
GOCOVERDIR="$(pwd)/.coverage"
|
||||||
|
export GOCOVERDIR
|
||||||
|
|
||||||
# Make sure 'func' binary is built in case KN FUNC was not required for testing
|
# Make sure 'func' binary is built in case KN FUNC was not required for testing
|
||||||
if [[ ! -f func && "$use_kn_func" != "true" ]]; then
|
if [[ ! -f func && "$use_kn_func" != "true" ]]; then
|
||||||
|
@ -57,5 +58,6 @@ go clean -testcache
|
||||||
go test -v -test.v -test.timeout=45m -tags="e2elc" ./test/e2e/
|
go test -v -test.v -test.timeout=45m -tags="e2elc" ./test/e2e/
|
||||||
ret=$?
|
ret=$?
|
||||||
|
|
||||||
cd $curdir
|
go tool covdata textfmt -i=./.coverage -o coverage.txt
|
||||||
|
popd
|
||||||
exit $ret
|
exit $ret
|
||||||
|
|
|
@ -35,9 +35,10 @@ set -o pipefail
|
||||||
runtime=${1:-}
|
runtime=${1:-}
|
||||||
use_kn_func=${E2E_USE_KN_FUNC:-}
|
use_kn_func=${E2E_USE_KN_FUNC:-}
|
||||||
|
|
||||||
curdir=$(pwd)
|
pushd "$(dirname "$0")/.."
|
||||||
cd $(dirname $0)
|
mkdir -p .coverage
|
||||||
cd ../
|
GOCOVERDIR="$(pwd)/.coverage"
|
||||||
|
export GOCOVERDIR
|
||||||
|
|
||||||
REGISTRY_PROJ=knfunc$(head -c 128 </dev/urandom | LC_CTYPE=C tr -dc 'a-z0-9' | fold -w 8 | head -n 1)
|
REGISTRY_PROJ=knfunc$(head -c 128 </dev/urandom | LC_CTYPE=C tr -dc 'a-z0-9' | fold -w 8 | head -n 1)
|
||||||
export E2E_REGISTRY_URL=${E2E_REGISTRY_URL:-ttl.sh/$REGISTRY_PROJ}
|
export E2E_REGISTRY_URL=${E2E_REGISTRY_URL:-ttl.sh/$REGISTRY_PROJ}
|
||||||
|
@ -54,5 +55,6 @@ go clean -testcache
|
||||||
go test -v -test.v -test.timeout=90m -tags="${TEST_TAGS:-oncluster}" ./test/oncluster/
|
go test -v -test.v -test.timeout=90m -tags="${TEST_TAGS:-oncluster}" ./test/oncluster/
|
||||||
ret=$?
|
ret=$?
|
||||||
|
|
||||||
cd $curdir
|
go tool covdata textfmt -i=./.coverage -o coverage.txt
|
||||||
|
popd
|
||||||
exit $ret
|
exit $ret
|
||||||
|
|
Loading…
Reference in New Issue