Skip to content

Commit

Permalink
Merge branch 'main' into chore/ci_cache_restore_key
Browse files Browse the repository at this point in the history
  • Loading branch information
mflendrich authored Jun 14, 2021
2 parents df73b98 + d764097 commit b4114c8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/2x-integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ jobs:
- name: run railgun integration tests
run: make test.integration.dbless
working-directory: ./railgun
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
directory: ./railgun
flags: integration-test
fail_ci_if_error: true
integration-test-postgres:
runs-on: ubuntu-latest
steps:
Expand All @@ -51,3 +57,9 @@ jobs:
- name: run railgun integration tests
run: make test.integration.postgres
working-directory: ./railgun
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
directory: ./railgun
flags: integration-test
fail_ci_if_error: true
1 change: 1 addition & 0 deletions .github/workflows/common-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
flags: unit-test
fail_ci_if_error: true
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ _testmain.go
.coverprofile
/gover.coverprofile
e2e-tests
coverage.out
coverage.out.tmp
coverage.txt
*.out
*.out.*

# for this repo only
kong-ingress-controller
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ DB?=false
RUN_VERSION?=20
KUBE_VERSION?=v1.20.2

PKG_LIST := ./...

ifndef COMMIT
COMMIT := $(shell git rev-parse --short HEAD)
endif
Expand All @@ -20,11 +22,11 @@ test-all: lint test

.PHONY: test
test:
go test -race ./...
go test -race -covermode=atomic -coverpkg=$(PKG_LIST) $(PKG_LIST)

.PHONY: coverage
coverage:
go test -race -v -count=1 -coverprofile=coverage.out.tmp ./...
go test -race -v -count=1 -covermode=atomic -coverpkg=$(PKG_LIST) -coverprofile=coverage.out.tmp $(PKG_LIST)
# ignoring generated code for coverage
grep -E -v 'pkg/apis/|pkg/client/|generated.go|generated.deepcopy.go' coverage.out.tmp > coverage.out
rm -f coverage.out.tmp
Expand Down
12 changes: 8 additions & 4 deletions railgun/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ IMG ?= controller:latest

##@ Testing Vars

PKG_LIST = ./...
COVERAGE_PROFILE=coverage.out
COVERAGE_INTEGRATION_PROFILE=coverage-integration.out

KIND_CLUSTER_NAME ?= "integration-tests"

##@ Build Vars
Expand Down Expand Up @@ -63,7 +67,7 @@ ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
test: manifests generate fmt vet ## Run tests.
mkdir -p ${ENVTEST_ASSETS_DIR}
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.0/hack/setup-envtest.sh
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test -race -covermode=atomic -coverpkg=$(PKG_LIST) $(PKG_LIST) -coverprofile=$(COVERAGE_PROFILE)

##@ Build

Expand Down Expand Up @@ -162,18 +166,18 @@ test.integration: test.integration.dbless test.integration.postgres
.PHONY: test.integration.dbless
test.integration.dbless:
@./scripts/setup-integration-tests.sh
@TEST_DATABASE_MODE="off" GOFLAGS="-tags=integration_tests" go test -race -v ./test/integration/
@TEST_DATABASE_MODE="off" GOFLAGS="-tags=integration_tests" go test -race -v -count=1 -covermode=atomic -coverpkg=$(PKG_LIST) -coverprofile=$(COVERAGE_INTEGRATION_PROFILE) ./test/integration/

# Our integration tests using the postgres backend, with verbose output
# TODO: race checking has been temporarily turned off because of race conditions found with deck. This will be resolved in an upcoming Alpha release of KIC 2.0.
# See: https://github.com/Kong/kubernetes-ingress-controller/issues/1324
.PHONY: test.integration.postgres
test.integration.postgres:
@./scripts/setup-integration-tests.sh
@TEST_DATABASE_MODE="postgres" GOFLAGS="-tags=integration_tests" go test -v ./test/integration/
@TEST_DATABASE_MODE="postgres" GOFLAGS="-tags=integration_tests" go test -v -count=1 -covermode=atomic -coverpkg=$(PKG_LIST) -coverprofile=$(COVERAGE_INTEGRATION_PROFILE) ./test/integration/

# Our integration tests using the legacy v1 controller manager
.PHONY: test.integration.legacy
test.integration.legacy:
@./scripts/setup-integration-tests.sh
@KONG_LEGACY_CONTROLLER=1 GOFLAGS="-tags=integration_tests" go test -race -v ./test/integration/
@KONG_LEGACY_CONTROLLER=1 GOFLAGS="-tags=integration_tests" go test -race -v -count=1 -covermode=atomic -coverpkg=$(PKG_LIST) -coverprofile=$(COVERAGE_INTEGRATION_PROFILE) ./test/integration/

0 comments on commit b4114c8

Please sign in to comment.