Skip to content

Commit 71a10b0

Browse files
authored
Use go build tags to separate task smoke tests (#635)
* Use go build tags to separate task smoke tests. There should be a clear separation of unit and smoke/integration tests. * Do not use -test.short to flag integration tests. * Make naming less terse.
1 parent 896354d commit 71a10b0

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

.github/workflows/build-ami.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: build-ami
2-
on:
2+
on:
33
push:
44
branches: [master]
55
paths: [environment/**]

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Release
2-
on:
2+
on:
33
release:
44
types: [published]
55
jobs:

.github/workflows/smoke.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ jobs:
4646
with:
4747
aws-region: us-west-1
4848
role-to-assume: arn:aws:iam::342840881361:role/SandboxUser
49-
- run: go test ./task -v -timeout=30m -count=1
49+
- run: go test ./task -v -timeout=30m -count=1 -tags=smoke
5050
- if: always()
5151
uses: actions/checkout@v2
5252
with:
5353
ref: master
5454
- if: always()
55-
run: go test ./task -v -timeout=30m -count=1
55+
run: go test ./task -v -timeout=30m -count=1 -tags=smoke
5656
env:
5757
SMOKE_TEST_SWEEP: true
5858
test-k8s:
@@ -110,7 +110,7 @@ jobs:
110110
-e 's/\n/%0A/g;' \
111111
-e 's/\r/%0D/g;' \
112112
-e 's/(.+)/::add-mask::\1\n::set-output name=kubeconfig::\1\n/g'
113-
- run: go test ./task -v -timeout=30m -count=1
113+
- run: go test ./task -v -timeout=30m -count=1 -tags=smoke
114114
env:
115115
KUBECONFIG_DATA: ${{ steps.cluster.outputs.kubeconfig }}
116116
SMOKE_TEST_ENABLE_K8S: true

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ install:
1515
GOBIN=${INSTALL_PATH} go install
1616

1717
test:
18-
go test ./... ${TESTARGS} -timeout=30s -parallel=4 -short
18+
go test ./... ${TESTARGS} -timeout=30s -parallel=4
1919

2020
smoke:
21-
go test ./task -v ${TESTARGS} -timeout=30m -count=1
21+
go test ./task -v ${TESTARGS} -timeout=30m -count=1 -tags=smoke
2222

2323
sweep:
2424
SMOKE_TEST_SWEEP=true go test ./task -v ${TESTARGS} -timeout=30m -count=1

task/task_test.go renamed to task/task_smoke_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build smoke
2+
13
package task
24

35
import (
@@ -17,11 +19,9 @@ import (
1719
"terraform-provider-iterative/task/common"
1820
)
1921

20-
func TestTask(t *testing.T) {
21-
if testing.Short() {
22-
t.Skip("go test -short detected, skipping smoke tests")
23-
}
24-
22+
// TestTaskSmoke runs smoke tests with specified infrastructure providers.
23+
// Cloud provider access credentials (provided as environment variables) are required.
24+
func TestTaskSmoke(t *testing.T) {
2525
testName := os.Getenv("SMOKE_TEST_IDENTIFIER")
2626
sweepOnly := os.Getenv("SMOKE_TEST_SWEEP") != ""
2727

0 commit comments

Comments
 (0)