Skip to content

Commit

Permalink
Move to Makefile-based instead of script-based integration test execu…
Browse files Browse the repository at this point in the history
…tion

Signed-off-by: Chun-Hung Tseng <[email protected]>
  • Loading branch information
henrybear327 committed Jun 10, 2024
1 parent ea2d4e0 commit 413f666
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/govuln.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Go Vulnerability Checker
on: [push, pull_request]
permissions: read-all
jobs:
test:
govuln:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: integration_tests
name: Integration Tests
on:
push:
tags:
Expand All @@ -13,8 +13,7 @@ permissions:
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
test:
name: lint
integration-test:
runs-on: ubuntu-latest
steps:
- id: goversion
Expand All @@ -25,4 +24,4 @@ jobs:
- uses: actions/checkout@v4
- name: tests
run: |
make run-all-integration-test
make run-all-integration-tests
19 changes: 1 addition & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SRCS=$(filter-out %_test.go, $(wildcard *.go */*.go))
include integration/makefile.mk

.PHONY: all
all: gofail
Expand All @@ -18,24 +19,6 @@ verify-gofmt:
test:
go test -v --race -cpu=1,2,4 ./code/ ./runtime/

# run all integration tests
.PHONY: run-all-integration-test
run-all-integration-test: run-integration-test-sleep

.PHONY: build-integration-test
build-integration-test: gofail

.PHONY: cleanup-integration-test
cleanup-integration-test: clean

# run integration test - sleep
.PHONY: run-integration-test-sleep
run-integration-test-sleep: build-integration-test execute-integration-test-sleep cleanup-integration-test

.PHONY: execute-integration-test-sleep
execute-integration-test-sleep:
./integration/sleep/execute.sh

fix: fix-gofmt

.PHONY: fix-gofmt
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module go.etcd.io/gofail

go 1.21

toolchain go1.21.11
go 1.21.11

require github.com/stretchr/testify v1.9.0

Expand Down
24 changes: 24 additions & 0 deletions integration/makefile.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
GOFAIL_BINARY = $(shell pwd)/gofail

# run all integration tests
.PHONY: run-all-integration-tests
run-all-integration-tests: run-integration-test-sleep

# run integration test - sleep
.PHONY: run-integration-test-sleep
run-integration-test-sleep: build-gofail execute-integration-test-sleep remove-gofail

.PHONY: execute-integration-test-sleep
execute-integration-test-sleep:
@echo "GOFAIL_BINARY = ${GOFAIL_BINARY}"
cd ./integration/sleep/failpoints && ${GOFAIL_BINARY} enable && cd .. && go build -o integration_test_sleep . && cd failpoints && ${GOFAIL_BINARY} disable
cd ./integration/sleep && ./integration_test_sleep && rm integration_test_sleep

# helper: build/remove gofail binaries
.PHONY: build-gofail
build-gofail:
make clean && make gofail

.PHONY: remove-gofail
remove-gofail:
make clean
20 changes: 0 additions & 20 deletions integration/sleep/execute.sh

This file was deleted.

0 comments on commit 413f666

Please sign in to comment.