diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 420bf1e62..d3f422049 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 - name: Install go-junit-report run: go install github.com/jstemmer/go-junit-report/v2@latest diff --git a/.github/workflows/nightly_smoke_tests.yml b/.github/workflows/nightly_smoke_tests.yml index 984ee8282..24923694d 100644 --- a/.github/workflows/nightly_smoke_tests.yml +++ b/.github/workflows/nightly_smoke_tests.yml @@ -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 }} diff --git a/.github/workflows/release-cross-repo-test.yml b/.github/workflows/release-cross-repo-test.yml index ace3f8ed0..539749f52 100644 --- a/.github/workflows/release-cross-repo-test.yml +++ b/.github/workflows/release-cross-repo-test.yml @@ -36,6 +36,6 @@ jobs: - name: run tests run: | - make int-test + make test-int env: LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }} diff --git a/Makefile b/Makefile index 1296b5776..04aae0303 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 ./... @@ -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" diff --git a/README.md b/README.md index 4eb779a08..0875968bf 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/test/Makefile b/test/Makefile index 22e743cb1..40371f285 100644 --- a/test/Makefile +++ b/test/Makefile @@ -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) \ No newline at end of file