Skip to content

Commit 274636a

Browse files
Merge pull request #1757 from linode/dev
v2.34.0
2 parents 070def3 + fd24156 commit 274636a

File tree

89 files changed

+1292
-427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1292
-427
lines changed

.github/workflows/integration_tests.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
name: Integration Tests
22

33
on:
4-
workflow_dispatch: null
4+
workflow_dispatch:
5+
inputs:
6+
parallel_value:
7+
description: 'Number of parallel test executions for every user'
8+
required: false
9+
run_long_tests:
10+
description: 'Choose whether to run long-duration tests that may take additional time. Set to "true" to enable long tests e.g. database related cases. Default is "false"'
11+
required: false
12+
default: 'false'
13+
type: choice
14+
options:
15+
- 'true'
16+
- 'false'
17+
518
push:
619
branches:
720
- main
@@ -37,24 +50,24 @@ jobs:
3750
- name: Install go-junit-report
3851
run: go install github.com/jstemmer/go-junit-report/v2@latest
3952

40-
# Note: test tags are not in alphabetical order, it was divided to optimize test execution time
53+
# Note: test suites are not in alphabetical order, it was divided to optimize test execution time
4154
- name: Set Test Scope for each Account
4255
run: |
4356
case "${{ matrix.user }}" in
4457
"USER_1")
45-
echo "TEST_TAGS=acceptance,backup,domain,domainrecord,domains,domainzonefile,helper,instance,provider" >> $GITHUB_ENV
58+
echo "TEST_SUITE=acceptance,backup,domain,domainrecord,domains,domainzonefile,helper,instance,provider" >> $GITHUB_ENV
4659
echo "LINODE_TOKEN=${{ secrets.LINODE_TOKEN_USER_1 }}" >> $GITHUB_ENV
4760
;;
4861
"USER_2")
49-
echo "TEST_TAGS=databasemysqlv2,firewall,firewalldevice,firewalls,image,images,instancenetworking,instancesharedips,instancetype,instancetypes,ipv6range,ipv6ranges,kernel,kernels,nb,nbconfig,nbconfigs,nbnode,nbs,sshkey,sshkeys,vlan,volume,volumes,vpc,vpcs,vpcsubnets" >> $GITHUB_ENV
62+
echo "TEST_SUITE=databasemysqlv2,firewall,firewalldevice,firewalls,image,images,instancenetworking,instancesharedips,instancetype,instancetypes,ipv6range,ipv6ranges,kernel,kernels,nb,nbconfig,nbconfigs,nbnode,nbs,sshkey,sshkeys,vlan,volume,volumes,vpc,vpcs,vpcsubnets" >> $GITHUB_ENV
5063
echo "LINODE_TOKEN=${{ secrets.LINODE_TOKEN_USER_2 }}" >> $GITHUB_ENV
5164
;;
5265
"USER_3")
53-
echo "TEST_TAGS=databasepostgresqlv2,instanceconfig,instancedisk,instanceip,networkingip,objcluster,objkey,profile,rdns,region,regions,stackscript,stackscripts" >> $GITHUB_ENV
66+
echo "TEST_SUITE=databasepostgresqlv2,instanceconfig,instancedisk,instanceip,networkingip,objcluster,objkey,profile,rdns,region,regions,stackscript,stackscripts" >> $GITHUB_ENV
5467
echo "LINODE_TOKEN=${{ secrets.LINODE_TOKEN_USER_3 }}" >> $GITHUB_ENV
5568
;;
5669
"USER_4")
57-
echo "TEST_TAGS=lke,lkeclusters,lkenodepool,lkeversions,obj,objbucket,placementgroup,placementgroups,placementgorupassignment,token,user,users" >> $GITHUB_ENV
70+
echo "TEST_SUITE=lke,lkeclusters,lkenodepool,lkeversions,obj,objbucket,placementgroup,placementgroups,placementgorupassignment,token,user,users" >> $GITHUB_ENV
5871
echo "LINODE_TOKEN=${{ secrets.LINODE_TOKEN_USER_4 }}" >> $GITHUB_ENV
5972
;;
6073
esac
@@ -64,7 +77,7 @@ jobs:
6477

6578
- name: Run Integration Tests
6679
run: |
67-
make TEST_TAGS="${{ env.TEST_TAGS }}" int-test | go-junit-report -set-exit-code -iocopy -out $REPORT_FILENAME
80+
make TEST_SUITE="${{ env.TEST_SUITE }}" PARALLEL="${{ github.event.inputs.parallel_value || '5' }}" test-int | go-junit-report -set-exit-code -iocopy -out $REPORT_FILENAME
6881
env:
6982
LINODE_TOKEN: ${{ env.LINODE_TOKEN }}
7083

@@ -152,7 +165,7 @@ jobs:
152165
python-version: '3.x'
153166

154167
- name: Install Python dependencies
155-
run: pip3 install requests wheel boto3
168+
run: pip3 install requests wheel boto3==1.35.99
156169

157170
- name: Download test report
158171
uses: actions/download-artifact@v4

.github/workflows/integration_tests_pr.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@ on:
22
pull_request:
33
workflow_dispatch:
44
inputs:
5-
module:
6-
description: 'The module to be tested.'
7-
required: true
8-
default: 'linode/...'
5+
test_suite:
6+
description: "Specify test suite to run from inside 'linode/' directory. Examples: 'account', 'domain', etc. If not provided, all suites are executed"
7+
required: false
8+
default: 'integration'
99
sha:
10-
description: 'The hash value of the commit.'
10+
description: 'Specify commit hash to test. This value is mandatory to ensure the tests run against a specific commit'
1111
required: true
1212
pull_request_number:
13-
description: 'The number of the PR.'
13+
description: 'Specify pull request number associated with the commit. Optional, but recommended when providing a commit hash (sha)'
1414
required: false
1515
run_long_tests:
16-
description: 'Setting this value will skip long running tests (e.g. Database related cases): (true|false)'
16+
description: 'Choose whether to run long-duration tests that may take additional time. Set to "true" to enable long tests e.g. database related cases. Default is "false"'
1717
required: false
18-
default: false
18+
default: 'false'
19+
type: choice
20+
options:
21+
- 'true'
22+
- 'false'
1923

2024

2125
name: Integration tests on PR
@@ -33,7 +37,7 @@ jobs:
3337
- uses: actions/github-script@v7
3438
id: disallowed-character-check
3539
env:
36-
text: ${{ inputs.module }}
40+
text: ${{ inputs.test_suite }}
3741
with:
3842
result-encoding: string
3943
script: |
@@ -55,7 +59,7 @@ jobs:
5559

5660
- run: make deps
5761

58-
- run: make PKG_NAME="${{ inputs.module }}" int-test
62+
- run: make TEST_SUITE="${{ inputs.test_suite }}" test-int
5963
if: ${{ steps.disallowed-character-check.outputs.result == 'pass' }}
6064
env:
6165
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}

.github/workflows/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: actions/checkout@v4
2222
-
2323
name: Run Labeler
24-
uses: crazy-max/ghaction-github-labeler@b54af0c25861143e7c8813d7cbbf46d2c341680c
24+
uses: crazy-max/ghaction-github-labeler@31674a3852a9074f2086abcf1c53839d466a47e7
2525
with:
2626
github-token: ${{ secrets.GITHUB_TOKEN }}
2727
yaml-file: .github/labels.yml

.github/workflows/nightly_smoke_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Run smoke tests
3737
id: smoke_tests
3838
run: |
39-
make smoke-test
39+
make test-smoke
4040
env:
4141
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
4242

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Lint
1616
run: make lint
1717
- name: Unit tests
18-
run: make unit-test
18+
run: make test-unit
1919
- name: Vet
2020
run: make vet
2121
- name: Tidy

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
run: make deps
2323

2424
- name: Run unit tests
25-
run: make unit-test
25+
run: make test-unit

Makefile

Lines changed: 40 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
COUNT?=1
2-
PARALLEL?=10
3-
PKG_NAME=linode/...
4-
TIMEOUT?=240m
5-
RUN_LONG_TESTS?=false
6-
SWEEP?="tf_test,tf-test"
7-
TEST_TAGS="integration"
8-
9-
MARKDOWNLINT_IMG := 06kellyjac/markdownlint-cli
10-
MARKDOWNLINT_TAG := 0.28.1
11-
12-
IP_ENV_FILE := /tmp/linode/ip_vars.env
1+
SHELL := /bin/bash
132

143
.PHONY: default
154
default: build
@@ -57,55 +46,57 @@ vet:
5746
golangci-lint run --disable-all --enable govet ./...
5847

5948
.PHONY: test
60-
test: fmt-check smoke-test unit-test int-test
61-
62-
.PHONY: unit-test
63-
unit-test: fmt-check
64-
go test -v --tags=unit ./$(PKG_NAME)
65-
66-
.PHONY: int-test
67-
int-test: fmt-check generate-ip-env-fw-e2e include-env
68-
TF_ACC=1 \
69-
LINODE_API_VERSION="v4beta" \
70-
RUN_LONG_TESTS=$(RUN_LONG_TESTS) \
71-
TF_VAR_ipv4_addr=${PUBLIC_IPV4} \
72-
TF_VAR_ipv6_addr=${PUBLIC_IPV6} \
73-
go test --tags="$(TEST_TAGS)" -v ./$(PKG_NAME) -count $(COUNT) -timeout $(TIMEOUT) -ldflags="-X=github.com/linode/terraform-provider-linode/v2/version.ProviderVersion=acc" -parallel=$(PARALLEL) $(ARGS)
49+
test: fmt-check test-unit test-smoke test-int
7450

75-
.PHONY: include-env
76-
include-env: $(IP_ENV_FILE)
77-
-include $(IP_ENV_FILE)
51+
.PHONY: test-unit
52+
test-unit: fmt-check
53+
go test -v --tags=unit ./$(if $(PKG_NAME),linode/$(PKG_NAME),linode/...)
7854

79-
generate-ip-env-fw-e2e: $(IP_ENV_FILE)
55+
IP_ENV_FILE = /tmp/linode/ip_vars.env
56+
SUBMODULE_DIR = e2e_scripts
57+
E2E_SCRIPT = ./e2e_scripts/cloud_security_scripts/cloud_e2e_firewall/terraform-provider-linode/generate_ip_env_fw_e2e.sh
8058

81-
SUBMODULE_DIR := e2e_scripts
59+
# Generate IP env file
60+
.PHONY: generate-ip-env
61+
generate-ip-env: $(IP_ENV_FILE)
8262

8363
$(IP_ENV_FILE):
84-
# Generate env file for E2E cloud firewall
8564
@if [ ! -d $(SUBMODULE_DIR) ]; then \
8665
echo "Submodule directory $(SUBMODULE_DIR) does not exist. Updating submodules..."; \
8766
git submodule update --init --recursive; \
88-
else \
89-
echo "Submodule directory $(SUBMODULE_DIR) already exists. Skipping update."; \
9067
fi
91-
. ./e2e_scripts/cloud_security_scripts/cloud_e2e_firewall/terraform-provider-linode/generate_ip_env_fw_e2e.sh
68+
$(E2E_SCRIPT)
69+
70+
# TEST_SUITE: Optional, specify a test suite (e.g. domain), Default to run everything if not set
71+
# TEST_ARGS: Optional, additional arguments for go test (e.g. -o -json, etc)
72+
# PKG_NAME: Recommended usage with TEST_CASE argument for faster execution e.g. make PKG_NAME="volume" TEST_CASE="TestAccResourceVolume_basic" test-int
73+
# TEST_CASE: Optional, specify a test case (e.g. 'TestAccResourceVolume_basic')
74+
75+
# Integration Test
76+
.PHONY: test-int
77+
test-int: fmt-check generate-ip-env
78+
\
79+
TF_VAR_ipv4_addr=$(shell grep PUBLIC_IPV4 $(IP_ENV_FILE) | cut -d '=' -f2 | tr -d '[:space:]') \
80+
TF_VAR_ipv6_addr=$(shell grep PUBLIC_IPV6 $(IP_ENV_FILE) | cut -d '=' -f2 | tr -d '[:space:]') \
81+
TF_ACC=1 \
82+
LINODE_API_VERSION="v4beta" \
83+
RUN_LONG_TESTS=$(if $(RUN_LONG_TESTS),$(RUN_LONG_TESTS),false) \
84+
bash -c 'set -o pipefail && go test --tags=$(if $(TEST_SUITE),$(TEST_SUITE),"integration") -v ./$(if $(PKG_NAME),linode/$(PKG_NAME),linode/...) \
85+
-count $(if $(COUNT),$(COUNT),1) -timeout $(if $(TIMEOUT),$(TIMEOUT),240m) -ldflags="-X=github.com/linode/terraform-provider-linode/v2/version.ProviderVersion=acc" -parallel $(if $(PARALLEL),$(PARALLEL),10) $(if $(TEST_CASE),-run $(TEST_CASE)) $(if $(TEST_ARGS),$(TEST_ARGS)) | sed -e "/testing: warning: no tests to run/,+1d" -e "/\[no test files\]/d" -e "/\[no tests to run\]/d"'
9286

93-
.PHONY: smoke-test
94-
smoke-test: fmt-check generate-ip-env-fw-e2e include-env
87+
.PHONY: test-smoke
88+
test-smoke: fmt-check generate-ip-env
89+
\
9590
TF_ACC=1 \
9691
LINODE_API_VERSION="v4beta" \
9792
RUN_LONG_TESTS=$(RUN_LONG_TESTS) \
98-
TF_VAR_ipv4_addr=${PUBLIC_IPV4} \
99-
TF_VAR_ipv6_addr=${PUBLIC_IPV6} \
93+
TF_VAR_ipv4_addr=$(shell grep PUBLIC_IPV4 $(IP_ENV_FILE) | cut -d '=' -f2 | tr -d '[:space:]') \
94+
TF_VAR_ipv6_addr=$(shell grep PUBLIC_IPV6 $(IP_ENV_FILE) | cut -d '=' -f2 | tr -d '[:space:]') \
10095
bash -c 'set -o pipefail && go test -v ./linode/... -run TestSmokeTests -tags=integration \
101-
-count $(COUNT) \
102-
-timeout $(TIMEOUT) \
103-
-parallel=$(PARALLEL) \
104-
-ldflags="-X=github.com/linode/terraform-provider-linode/v2/version.ProviderVersion=acc" \
105-
| sed -e "/testing: warning: no tests to run/,+1d" -e "/\[no test files\]/d" -e "/\[no tests to run\]/d"; \
106-
exit_status=$$?; \
107-
exit $$exit_status'
96+
-count $(if $(COUNT),$(COUNT),1) -timeout $(if $(TIMEOUT),$(TIMEOUT),240m) -ldflags="-X=github.com/linode/terraform-provider-linode/v2/version.ProviderVersion=acc" -parallel $(if $(PARALLEL),$(PARALLEL),10) $(if $(TEST_ARGS),$(TEST_ARGS)) | sed -e "/testing: warning: no tests to run/,+1d" -e "/\[no test files\]/d" -e "/\[no tests to run\]/d"'
10897

98+
MARKDOWNLINT_IMG := 06kellyjac/markdownlint-cli
99+
MARKDOWNLINT_TAG := 0.28.1
109100

110101
.PHONY: docs-check
111102
docs-check:
@@ -116,8 +107,10 @@ docs-check:
116107
--config .markdownlint.yml \
117108
docs
118109

110+
SWEEP?="tf_test,tf-test"
111+
119112
.PHONY: sweep
120113
sweep:
121114
# sweep cleans the test infra from your account
122115
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
123-
go test -v ./$(PKG_NAME) -sweep=$(SWEEP) $(ARGS)
116+
go test -v ./$(if $(PKG_NAME),linode/$(PKG_NAME),linode/...) -sweep=$(SWEEP) $(TEST_ARGS)

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,25 @@ make
5454

5555
### Testing the provider
5656

57-
In order to run the full suite of Acceptance tests, run `make int-test`. Acceptance testing will require the `LINODE_TOKEN` variable to be populated with a Linode APIv4 Token. See [Linode Provider documentation](https://www.terraform.io/docs/providers/linode/index.html) for more details.
57+
In order to run the full suite of Acceptance tests, run `make test-int`. Acceptance testing will require the `LINODE_TOKEN` variable to be populated with a Linode APIv4 Token. See [Linode Provider documentation](https://www.terraform.io/docs/providers/linode/index.html) for more details.
5858

5959
*Note:* Acceptance tests create real resources, and often cost money to run.
6060

6161
```sh
62-
make int-test
62+
make test-int
6363
```
6464

65-
Use the following command template to execute specific Acceptance test
65+
Use the following command template to execute specific Acceptance test,
6666

6767
```shell
68-
make ARGS="-run TestAccResourceVolume_basic" int-test
68+
# PKG_NAME is the directory in linode/ that contains the corresponding TEST_CASE
69+
make PKG_NAME="volume" TEST_CASE="TestAccResourceVolume_basic" test-int
6970
```
7071

7172
Use the following command template to execute particular Acceptance tests within a specific package
7273

7374
```shell
74-
make TEST_TAGS="volume" int-test
75+
make TEST_SUITE="volume" test-int
7576
```
7677

7778
There are a number of useful flags and variables to aid in debugging.

docs/data-sources/lke_cluster.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ In addition to all arguments above, the following attributes are exported:
6161

6262
* `tags` - An array of tags applied to this object. Tags are case-insensitive and are for organizational purposes only.
6363

64+
* `tier` - The desired Kubernetes tier. (**Note: v4beta only and may not currently be available to all users.**)
65+
6466
* `nodes` - The nodes in the Node Pool.
6567

6668
* `id` - The ID of the node.

docs/data-sources/lke_clusters.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ Each LKE Cluster will be stored in the `lke_clusters` attribute and will export
6464

6565
* `region` - This Kubernetes cluster's location.
6666

67+
* `tier` - The desired Kubernetes tier. (**Note: v4beta only and may not currently be available to all users.**)
68+
6769
* `control_plane.high_availability` - Whether High Availability is enabled for the cluster Control Plane.
6870

6971
To get more information about a cluster, i.e. node pools, please refer to the [linode_lke_cluster](lke_cluster.html.markdown) data source.

0 commit comments

Comments
 (0)