Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split e2e tests from unit tests: #725

Merged
merged 2 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
- name: Install nix
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Install required nix packages
run: nix-shell --run 'true'
- run: make test
- name: Run unit tests
run: make test
- name: Run e2e tests
run: make e2e-test
- name: Upload codecov
run: bash <(curl -s https://codecov.io/bash)
checks:
Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Only use the recipes defined in these makefiles
MAKEFLAGS += --no-builtin-rules

PATH := $(PATH):$(PWD)/bin

# Use bash instead of plain sh and treat the shell as one shell script invocation.
SHELL := bash
.SHELLFLAGS := -o pipefail -euc
Expand Down Expand Up @@ -57,13 +59,7 @@ build: $(BINARIES) ## Build all tink binaries. Cross build by setting GOOS and G
# See https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html.
.PHONY: $(BINARIES)
$(BINARIES):
CGO_ENABLED=0 \
GOOS=$(GOOS) \
GOARCH=$(GOARCH) \
$(GO) build \
$(LDFLAGS) \
-o ./bin/$@-$(GOOS)-$(GOARCH) \
./cmd/$@
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build $(LDFLAGS) -o ./bin/$@-$(GOOS)-$(GOARCH) ./cmd/$@

# IMAGE_ARGS is resolved when its used in the `%-image` targets. Consequently, the $* automatic
# variable isn't evaluated until the target is called.
Expand Down Expand Up @@ -91,8 +87,12 @@ images: $(addsuffix -image,$(BINARIES)) ## Build all tink container images. All

.PHONY: test
test: ## Run tests
$(GO) test -coverprofile=coverage.txt ./...

.PHONY: e2e-test
e2e-test: ## Run e2e tests
$(SETUP_ENVTEST) use
source <($(SETUP_ENVTEST) use -p env) && $(GO) test -coverprofile=coverage.txt ./...
source <($(SETUP_ENVTEST) use -p env) && $(GO) test -v ./internal/e2e/... -tags=e2e

.PHONY: generate-proto
generate-proto: buf.gen.yaml buf.lock $(shell git ls-files '**/*.proto') _protoc
Expand Down Expand Up @@ -175,7 +175,7 @@ check-proto: generate-proto

.PHONY: verify
verify: lint check-generated ## Verify code style, is lint free, freshness ...
$(GOFUMPT) -s -d .
$(GOFUMPT) -d .

.PHONY: lint
lint: shellcheck hadolint golangci-lint yamllint ## Lint code
Expand Down
2 changes: 1 addition & 1 deletion buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 5ae7f88519b04fe1965da0f8a375a088
commit: cc916c31859748a68fd229a3c8d7a2e8
2 changes: 2 additions & 0 deletions internal/e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build e2e

package e2e_test

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/e2e/tink_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build e2e

package e2e_test

import (
Expand Down