Skip to content

Commit 12c7cc3

Browse files
committed
Split test and acceptance tests into different paths
1 parent 5b8db00 commit 12c7cc3

File tree

3 files changed

+53
-26
lines changed

3 files changed

+53
-26
lines changed

.github/workflows/main-test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Runs acceptance tests on merge to main
2+
name: Acceptance Tests
3+
4+
on:
5+
push:
6+
branches:
7+
- "main"
8+
- "akwirick/fix-testing-requirements" # TODO remove post-verification
9+
paths-ignore:
10+
- "README.md"
11+
- "CHANGELOG.md"
12+
- "TODO.md"
13+
14+
permissions:
15+
contents: read
16+
17+
18+
jobs:
19+
build-and-test:
20+
uses: ./.github/workflows/test.yml
21+
acceptance-test:
22+
name: Terraform Provider Acceptance Tests
23+
needs: build-and-test
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 15
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
# list whatever Terraform versions here you would like to support
30+
terraform:
31+
- "1.10.*"
32+
steps:
33+
- uses: actions/[email protected]
34+
- uses: actions/[email protected]
35+
with:
36+
go-version-file: "go.mod"
37+
cache: true
38+
- uses: hashicorp/[email protected]
39+
with:
40+
terraform_version: ${{ matrix.terraform }}
41+
terraform_wrapper: false
42+
- run: go mod download
43+
- name: Acceptance tests
44+
env:
45+
TF_ACC: "1"
46+
CORTEX_API_TOKEN: ${{ secrets.CORTEX_API_TOKEN }}
47+
run: make testacc

.github/workflows/test.yml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ name: Tests
55
# Optionally, you can turn it on using a schedule for regular testing.
66
on:
77
pull_request:
8-
push:
9-
branches:
10-
- "main"
11-
paths-ignore:
12-
- "README.md"
13-
- "CHANGELOG.md"
14-
- "TODO.md"
158

169
# Testing only needs permissions to read the repository contents.
1710
permissions:
@@ -50,7 +43,7 @@ jobs:
5043
cache: true
5144
- uses: hashicorp/[email protected]
5245
with:
53-
terraform_version: ${{ matrix.terraform }}
46+
terraform_version: "1.10.*"
5447
terraform_wrapper: false
5548
- run: go generate ./...
5649
- name: git diff
@@ -60,29 +53,16 @@ jobs:
6053
6154
# Run acceptance tests in a matrix with Terraform CLI versions
6255
test:
63-
name: Terraform Provider Acceptance Tests
56+
name: Unit Test
6457
needs: build
6558
runs-on: ubuntu-latest
66-
timeout-minutes: 15
67-
strategy:
68-
fail-fast: false
69-
matrix:
70-
# list whatever Terraform versions here you would like to support
71-
terraform:
72-
- "1.10.*"
59+
timeout-minutes: 5
7360
steps:
7461
- uses: actions/[email protected]
7562
- uses: actions/[email protected]
7663
with:
7764
go-version-file: "go.mod"
7865
cache: true
79-
- uses: hashicorp/[email protected]
80-
with:
81-
terraform_version: ${{ matrix.terraform }}
82-
terraform_wrapper: false
8366
- run: go mod download
84-
- env:
85-
TF_ACC: "1"
86-
CORTEX_API_TOKEN: ${{ secrets.CORTEX_API_TOKEN }}
87-
run: go test -v -cover ./... # later, change to: ./internal/provider/
88-
timeout-minutes: 10
67+
- name: Unit tests
68+
run: make test

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ test:
4646
# acceptance tests
4747
testacc:
4848
go clean -testcache
49-
TF_LOG=$(TF_LOG) TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m
49+
TF_LOG=$(TF_LOG) TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 10m

0 commit comments

Comments
 (0)