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

test/workflow: Update make test commands and related workflows #657

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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
python-version: '3.x'

- name: Install Python deps
run: pip3 install requests wheel boto3
run: pip3 install requests wheel boto3==1.35.99
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rolling back boto3 version to address report upload issue


- name: Install go-junit-report
run: go install github.com/jstemmer/go-junit-report/v2@latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_smoke_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Run smoke tests
id: smoke_tests
run: |
make smoketest
make test-smoke
env:
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-cross-repo-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ jobs:

- name: run tests
run: |
make int-test
make test-int
env:
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ PACKAGES := $(shell go list ./... | grep -v integration)

SKIP_LINT ?= 0

.PHONY: build vet test refresh-fixtures clean clean-cov clean-fixtures lint run_fixtures sanitize fixtures godoc testint testunit testcov tidy
.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

test: build lint testunit testint
test: build lint test-unit test-int

citest: lint test

testunit:
go test -v $(PACKAGES) $(ARGS)
cd test && make testunit
test-unit:
go test -v $(PACKAGES) $(TEST_ARGS)
cd test && make test-unit $(TEST_ARGS)

testint:
cd test && make testint
test-int:
cd test && make test-int $(TEST_ARGS)

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

smoketest:
cd test && make smoketest
test-smoke:
cd test && make test-smoke

build: vet lint
go build ./...
Expand Down Expand Up @@ -77,7 +77,7 @@ run_fixtures:
LINODE_API_VERSION="v4beta" \
LINODE_URL="$(LINODE_URL)" \
GO111MODULE="on" \
go test --tags $(TEST_TAGS) -timeout=$(TEST_TIMEOUT) -v $(ARGS)
go test --tags $(TEST_TAGS) -timeout=$(TEST_TIMEOUT) -v $(TEST_ARGS)

sanitize:
@echo "* Sanitizing fixtures"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ When performing a `POST` or `PUT` request, multiple field related errors will be

## Tests

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

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

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

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

## Discussion / Help

Expand Down
21 changes: 8 additions & 13 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
.PHONY: testint
.PHONY: test-int

testint:
test-int:
@LINODE_FIXTURE_MODE="play" \
LINODE_TOKEN="awesometokenawesometokenawesometoken" \
LINODE_API_VERSION="v4beta" \
GO111MODULE="on" \
go test -v ./integration $(ARGS)
go test -v ./integration $(TEST_ARGS)

.PHONY: testunit
.PHONY: test-unit

testunit:
go test -v ./unit/...
test-unit:
go test -v ./unit/... $(TEST_ARGS)

.PHONY: smoketest
.PHONY: test-smoke

smoketest:
test-smoke:
@LINODE_FIXTURE_MODE="record" \
LINODE_TOKEN=$(LINODE_TOKEN) \
LINODE_API_VERSION="v4beta" \
LINODE_URL="$(LINODE_URL)" \
GO111MODULE="on" \
go test -v -run smoke ./integration/...


.PHONY: unit-test
unit-test:
go test -v ./unit $(ARGS)