generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 9
130 lines (115 loc) · 5.39 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Tests
on:
pull_request:
paths-ignore:
- 'README.md'
push:
paths-ignore:
- 'README.md'
# schedule:
# - cron: '0 13 * * *'
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
id: go
- name: Get dependencies
run: |
go mod download
- name: Build
run: |
go build -v .
test:
name: Matrix Test
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
terraform:
- '1.7.5'
- '1.8.5'
- '1.9.8'
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build the docker-compose stack
env:
APPLICATION_SECRETS: ${{ secrets.APPLICATION_SECRETS }}
run: |
echo $APPLICATION_SECRETS | base64 -d > .github/docker/application-secrets.yml
docker compose -f docker-compose-ci.yml pull
docker compose -f docker-compose-ci.yml up -d zookeeper kafka elasticsearch vault
sleep 30
docker compose -f docker-compose-ci.yml up -d
sleep 30
echo "\echo 'path \"*\" {capabilities = [\"create\", \"read\", \"update\", \"delete\", \"list\", \"sudo\"]}' | vault policy write admins -" | docker exec --interactive terraform-provider-kestra-vault-1 sh -
docker compose -f docker-compose-ci.yml exec vault vault auth enable userpass
docker compose -f docker-compose-ci.yml exec vault vault write auth/userpass/users/john \
password=foo \
policies=admins \
token_period=1s
curl "127.27.27.27:9200" > /dev/null
curl -X POST "127.27.27.27:8080/api/v1/users" > /dev/null
curl -u [email protected]:pass -X POST -H 'Content-Type: application/json' -d '{"id":"unit_test","name":"Unit Test"}' "127.27.27.27:8080/api/v1/tenants" > /dev/null
curl -H "Content-Type: application/x-ndjson" -XPOST "127.27.27.27:9200/_bulk?pretty" --data-binary @.github/workflows/index.jsonl
sleep 3
curl -H "Content-Type: multipart/form-data" -u [email protected]:pass -X POST -F fileContent=@internal/resources/flow.py "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/files?path=/flow.py"
curl -H "Content-Type: text/plain" -u [email protected]:pass -X PUT -d '"stringValue"' "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/kv/string"
curl -H "Content-Type: text/plain" -u [email protected]:pass -X PUT -d '1' "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/kv/int"
curl -H "Content-Type: text/plain" -u [email protected]:pass -X PUT -d '1.5' "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/kv/double"
curl -H "Content-Type: text/plain" -u [email protected]:pass -X PUT -d 'false' "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/kv/falseBoolean"
curl -H "Content-Type: text/plain" -u [email protected]:pass -X PUT -d 'true' "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/kv/trueBoolean"
curl -H "Content-Type: text/plain" -u [email protected]:pass -X PUT -d '2022-05-01T03:02:01Z' "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/kv/dateTime"
curl -H "Content-Type: text/plain" -u [email protected]:pass -X PUT -d '2022-05-01' "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/kv/date"
curl -H "Content-Type: text/plain" -u [email protected]:pass -X PUT -d 'P3DT3H2M1S' "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/kv/duration"
curl -H "Content-Type: application/json" -u [email protected]:pass -X PUT -d '{"some":"value","in":"object"}' "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/kv/object"
curl -H "Content-Type: application/json" -u [email protected]:pass -X PUT -d '[{"some":"value","in":"object"},{"yet":"another","array":"object"}]' "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/kv/array"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
id: go
- name: Get dependencies
run: |
go mod download
- name: Terraform acceptance tests
timeout-minutes: 10
env:
TF_ACC: "1"
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }}
KESTRA_URL: "http://127.27.27.27:8080"
KESTRA_USERNAME: [email protected]
KESTRA_PASSWORD: pass
run: |
go test -v -cover ./internal/provider/
# Slack
- name: Slack notification
uses: 8398a7/action-slack@v3
if: failure() && github.event_name != 'pull_request'
with:
status: ${{ job.status }}
job_name: Matrix Test
fields: repo,commit,action,ref,job,took
username: GitHub Actions
icon_emoji: ':github-actions:'
channel: 'C02DQ1A7JLR'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}