Skip to content

Commit 7d14d5c

Browse files
authored
test/workflow: Update make test commands and related workflows (#657)
* update make test commands and workflows * add TEST_ARGS to unit and integration test commands * roll back boto3 version for test report upload
1 parent a8748fc commit 7d14d5c

File tree

6 files changed

+24
-29
lines changed

6 files changed

+24
-29
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
python-version: '3.x'
5151

5252
- name: Install Python deps
53-
run: pip3 install requests wheel boto3
53+
run: pip3 install requests wheel boto3==1.35.99
5454

5555
- name: Install go-junit-report
5656
run: go install github.com/jstemmer/go-junit-report/v2@latest

.github/workflows/nightly_smoke_tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Run smoke tests
3333
id: smoke_tests
3434
run: |
35-
make smoketest
35+
make test-smoke
3636
env:
3737
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
3838

.github/workflows/release-cross-repo-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ jobs:
3636
3737
- name: run tests
3838
run: |
39-
make int-test
39+
make test-int
4040
env:
4141
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}

Makefile

+10-10
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ PACKAGES := $(shell go list ./... | grep -v integration)
1717

1818
SKIP_LINT ?= 0
1919

20-
.PHONY: build vet test refresh-fixtures clean clean-cov clean-fixtures lint run_fixtures sanitize fixtures godoc testint testunit testcov tidy
20+
.PHONY: build vet test refresh-fixtures clean clean-cov clean-fixtures lint run_fixtures sanitize fixtures godoc test-int test-unit test-smoke testcov tidy
2121

22-
test: build lint testunit testint
22+
test: build lint test-unit test-int
2323

2424
citest: lint test
2525

26-
testunit:
27-
go test -v $(PACKAGES) $(ARGS)
28-
cd test && make testunit
26+
test-unit:
27+
go test -v $(PACKAGES) $(TEST_ARGS)
28+
cd test && make test-unit $(TEST_ARGS)
2929

30-
testint:
31-
cd test && make testint
30+
test-int:
31+
cd test && make test-int $(TEST_ARGS)
3232

3333
testcov-func:
3434
@go test -v -coverprofile="coverage.txt" . > /dev/null 2>&1
@@ -39,8 +39,8 @@ testcov-html:
3939
@go test -v -coverprofile="coverage.txt" . > /dev/null 2>&1
4040
@go tool cover -html coverage.txt
4141

42-
smoketest:
43-
cd test && make smoketest
42+
test-smoke:
43+
cd test && make test-smoke
4444

4545
build: vet lint
4646
go build ./...
@@ -77,7 +77,7 @@ run_fixtures:
7777
LINODE_API_VERSION="v4beta" \
7878
LINODE_URL="$(LINODE_URL)" \
7979
GO111MODULE="on" \
80-
go test --tags $(TEST_TAGS) -timeout=$(TEST_TIMEOUT) -v $(ARGS)
80+
go test --tags $(TEST_TAGS) -timeout=$(TEST_TIMEOUT) -v $(TEST_ARGS)
8181

8282
sanitize:
8383
@echo "* Sanitizing fixtures"

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,15 @@ When performing a `POST` or `PUT` request, multiple field related errors will be
168168

169169
## Tests
170170

171-
Run `make testunit` to run the unit tests.
171+
Run `make test-unit` to run the unit tests.
172172

173-
Run `make testint` to run the integration tests. The integration tests use fixtures.
173+
Run `make test-int` to run the integration tests. The integration tests use fixtures.
174174

175175
To update the test fixtures, run `make fixtures`. This will record the API responses into the `fixtures/` directory.
176176
Be careful about committing any sensitive account details. An attempt has been made to sanitize IP addresses and
177177
dates, but no automated sanitization will be performed against `fixtures/*Account*.yaml`, for example.
178178

179-
To prevent disrupting unaffected fixtures, target fixture generation like so: `make ARGS="-run TestListVolumes" fixtures`.
179+
To prevent disrupting unaffected fixtures, target fixture generation like so: `make TEST_ARGS="-run TestListVolumes" fixtures`.
180180

181181
## Discussion / Help
182182

test/Makefile

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
.PHONY: testint
1+
.PHONY: test-int
22

3-
testint:
3+
test-int:
44
@LINODE_FIXTURE_MODE="play" \
55
LINODE_TOKEN="awesometokenawesometokenawesometoken" \
66
LINODE_API_VERSION="v4beta" \
77
GO111MODULE="on" \
8-
go test -v ./integration $(ARGS)
8+
go test -v ./integration $(TEST_ARGS)
99

10-
.PHONY: testunit
10+
.PHONY: test-unit
1111

12-
testunit:
13-
go test -v ./unit/...
12+
test-unit:
13+
go test -v ./unit/... $(TEST_ARGS)
1414

15-
.PHONY: smoketest
15+
.PHONY: test-smoke
1616

17-
smoketest:
17+
test-smoke:
1818
@LINODE_FIXTURE_MODE="record" \
1919
LINODE_TOKEN=$(LINODE_TOKEN) \
2020
LINODE_API_VERSION="v4beta" \
2121
LINODE_URL="$(LINODE_URL)" \
2222
GO111MODULE="on" \
2323
go test -v -run smoke ./integration/...
24-
25-
26-
.PHONY: unit-test
27-
unit-test:
28-
go test -v ./unit $(ARGS)

0 commit comments

Comments
 (0)