Skip to content

Commit 9881ac9

Browse files
authored
tests: skip-defaults test for vaults (#1804)
* tests: skip-defaults test for vaults with gw * tests: added konnect tests for vaults * chore: updated go mod * tests: changed konnect vault name * tests: removed konnect-type vault * chore: updated gdr to v1.29.1
1 parent 409eba7 commit 9881ac9

File tree

9 files changed

+332
-3
lines changed

9 files changed

+332
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/fatih/color v1.18.0
1515
github.com/google/go-cmp v0.7.0
1616
github.com/kong/go-apiops v0.2.0
17-
github.com/kong/go-database-reconciler v1.29.0
17+
github.com/kong/go-database-reconciler v1.29.1
1818
github.com/kong/go-kong v0.69.0
1919
github.com/mitchellh/go-homedir v1.1.0
2020
github.com/spf13/cobra v1.9.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/q
244244
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
245245
github.com/kong/go-apiops v0.2.0 h1:QzHmEvl12vr3lxayTuY40dFuQpPECHTvopsILpwuLdE=
246246
github.com/kong/go-apiops v0.2.0/go.mod h1:yPwbl3P2eQinVGAEA0d3legaYmzPJ+WtJf9fSeGF4b8=
247-
github.com/kong/go-database-reconciler v1.29.0 h1:C+gktZVLTpyw2ausZuXdfOluM7mxp926P3Izn3hC0KQ=
248-
github.com/kong/go-database-reconciler v1.29.0/go.mod h1:DnqxRK/TH8HugJca1cw2n1NCApaNgpzEZhXUzITU0Ro=
247+
github.com/kong/go-database-reconciler v1.29.1 h1:YC6AaHTcaGJMd/j38YbEIwhNXtwPjGT9vhZ4tHsX388=
248+
github.com/kong/go-database-reconciler v1.29.1/go.mod h1:DnqxRK/TH8HugJca1cw2n1NCApaNgpzEZhXUzITU0Ro=
249249
github.com/kong/go-kong v0.69.0 h1:1LHU3y+i23X+RxxXT/bKml5bsxeUfKTfWFa3RK85cSU=
250250
github.com/kong/go-kong v0.69.0/go.mod h1:J0vGB3wsZ2i99zly1zTRe3v7rOKpkhQZRwbcTFP76qM=
251251
github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY=

tests/integration/dump_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,11 @@ func Test_Dump_SkipDefaults_Konnect(t *testing.T) {
922922
stateFile: "testdata/dump/009-skip-defaults/konnect/plugin-partial-2.yaml",
923923
expectedFile: "testdata/dump/009-skip-defaults/konnect/plugin-partial-2.expected.yaml",
924924
},
925+
{
926+
name: "dump skip-defaults: vaults",
927+
stateFile: "testdata/dump/009-skip-defaults/konnect/vaults.yaml",
928+
expectedFile: "testdata/dump/009-skip-defaults/konnect/vaults.expected.yaml",
929+
},
925930
}
926931

927932
for _, tc := range tests {
@@ -1010,6 +1015,24 @@ func Test_Dump_SkipDefaults(t *testing.T) {
10101015
expectedFile: "testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial-2.expected.yaml",
10111016
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.10.0") },
10121017
},
1018+
{
1019+
name: "vaults skip-defaults 3.4",
1020+
stateFile: "testdata/dump/009-skip-defaults/enterprise/3.4/vaults.yaml",
1021+
expectedFile: "testdata/dump/009-skip-defaults/enterprise/3.4/vaults.expected.yaml",
1022+
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.4.0 <3.5.0") },
1023+
},
1024+
{
1025+
name: "vaults skip-defaults 3.10+",
1026+
stateFile: "testdata/dump/009-skip-defaults/enterprise/3.4/vaults.yaml",
1027+
expectedFile: "testdata/dump/009-skip-defaults/enterprise/3.4/vaults.expected.yaml",
1028+
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.10.0") },
1029+
},
1030+
{
1031+
name: "vaults skip-defaults 3.11+",
1032+
stateFile: "testdata/dump/009-skip-defaults/enterprise/3.11+/vaults.yaml",
1033+
expectedFile: "testdata/dump/009-skip-defaults/enterprise/3.11+/vaults.expected.yaml",
1034+
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.11.0") },
1035+
},
10131036
}
10141037

10151038
for _, tc := range tests {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
_format_version: "3.0"
2+
vaults:
3+
- config:
4+
account: test-ac
5+
api_key: test-key
6+
endpoint_url: http://example-server.test
7+
login: test-id
8+
name: conjur
9+
prefix: my-conjur-vault
10+
tags:
11+
- tag1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
_format_version: "3.0"
2+
vaults:
3+
- config:
4+
account: test-ac
5+
api_key: test-key
6+
auth_method: api_key
7+
base64_decode: false
8+
endpoint_url: http://example-server.test
9+
login: test-id
10+
neg_ttl: null
11+
resurrect_ttl: null
12+
ttl: null
13+
name: conjur
14+
prefix: my-conjur-vault
15+
tags:
16+
- tag1
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
_format_version: "3.0"
2+
vaults:
3+
- config:
4+
endpoint_url: https://example-aws.com
5+
region: us-east-1
6+
name: aws
7+
prefix: my-aws-vault
8+
tags:
9+
- tag1
10+
- config:
11+
location: test-location
12+
vault_uri: http://azure-vault.test
13+
name: azure
14+
prefix: my-azure-vault
15+
tags:
16+
- tag1
17+
- config:
18+
prefix: TEST_
19+
name: env
20+
prefix: my-env-vault
21+
tags:
22+
- tag1
23+
- config:
24+
project_id: test-123
25+
name: gcp
26+
prefix: my-gcp-vault
27+
tags:
28+
- tag1
29+
- config:
30+
token: example-token
31+
name: hcv
32+
prefix: my-hcv-vault1
33+
tags:
34+
- tag1
35+
- config:
36+
auth_method: kubernetes
37+
kube_api_token_file: test-file
38+
kube_role: test-role
39+
name: hcv
40+
prefix: my-hcv-vault2
41+
tags:
42+
- tag1
43+
- config:
44+
approle_response_wrapping: true
45+
approle_role_id: test-id-123
46+
approle_secret_id: test-secret-123
47+
auth_method: approle
48+
name: hcv
49+
prefix: my-hcv-vault3
50+
tags:
51+
- tag2
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
_format_version: "3.0"
2+
vaults:
3+
- config:
4+
endpoint_url: https://example-aws.com
5+
region: us-east-1
6+
name: aws
7+
prefix: my-aws-vault
8+
tags:
9+
- tag1
10+
- config:
11+
location: test-location
12+
vault_uri: http://azure-vault.test
13+
name: azure
14+
prefix: my-azure-vault
15+
tags:
16+
- tag1
17+
- config:
18+
prefix: TEST_
19+
name: env
20+
prefix: my-env-vault
21+
tags:
22+
- tag1
23+
- config:
24+
project_id: test-123
25+
name: gcp
26+
prefix: my-gcp-vault
27+
tags:
28+
- tag1
29+
- config:
30+
token: example-token
31+
name: hcv
32+
prefix: my-hcv-vault1
33+
tags:
34+
- tag1
35+
- config:
36+
auth_method: kubernetes
37+
kube_api_token_file: test-file
38+
kube_role: test-role
39+
name: hcv
40+
prefix: my-hcv-vault2
41+
tags:
42+
- tag1
43+
- config:
44+
approle_response_wrapping: true
45+
approle_role_id: test-id-123
46+
approle_secret_id: test-secret-123
47+
auth_method: approle
48+
name: hcv
49+
prefix: my-hcv-vault3
50+
tags:
51+
- tag2
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
_format_version: "3.0"
2+
_konnect:
3+
control_plane_name: default
4+
vaults:
5+
- config:
6+
endpoint_url: https://example-aws.com
7+
region: us-east-1
8+
name: aws
9+
prefix: my-aws-vault
10+
tags:
11+
- tag1
12+
- config:
13+
endpoint_url: https://example-aws.com
14+
region: ap-south-1
15+
name: aws
16+
prefix: my-aws-vault-2
17+
tags:
18+
- tag1
19+
- config:
20+
location: test-location
21+
vault_uri: http://azure-vault.test
22+
name: azure
23+
prefix: my-azure-vault
24+
tags:
25+
- tag1
26+
- config:
27+
account: test-ac
28+
api_key: test-key
29+
endpoint_url: http://example-server.test
30+
login: test-id
31+
name: conjur
32+
prefix: my-conjur-vault
33+
tags:
34+
- tag1
35+
- config:
36+
prefix: TEST_
37+
name: env
38+
prefix: my-env-vault
39+
tags:
40+
- tag1
41+
- config:
42+
project_id: test-123
43+
name: gcp
44+
prefix: my-gcp-vault
45+
tags:
46+
- tag1
47+
- config:
48+
host: 127.0.0.1
49+
port: 8200
50+
token: example-token
51+
name: hcv
52+
prefix: my-hcv-vault1
53+
tags:
54+
- tag1
55+
- config:
56+
auth_method: kubernetes
57+
host: 127.0.0.1
58+
kube_api_token_file: test-file
59+
kube_role: test-role
60+
port: 8200
61+
name: hcv
62+
prefix: my-hcv-vault2
63+
tags:
64+
- tag1
65+
- config:
66+
approle_response_wrapping: true
67+
approle_role_id: test-id-123
68+
approle_secret_id: test-secret-123
69+
auth_method: approle
70+
host: 127.0.0.1
71+
port: 8200
72+
name: hcv
73+
prefix: my-hcv-vault3
74+
tags:
75+
- tag2
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
_format_version: "3.0"
2+
_konnect:
3+
control_plane_name: default
4+
vaults:
5+
- config:
6+
base64_decode: false
7+
endpoint_url: https://example-aws.com
8+
region: us-east-1
9+
role_session_name: KongVault
10+
name: aws
11+
prefix: my-aws-vault
12+
tags:
13+
- tag1
14+
- config:
15+
base64_decode: false
16+
endpoint_url: https://example-aws.com
17+
region: ap-south-1
18+
role_session_name: KongVault
19+
name: aws
20+
prefix: my-aws-vault-2
21+
tags:
22+
- tag1
23+
- config:
24+
base64_decode: false
25+
credentials_prefix: AZURE
26+
location: test-location
27+
type: secrets
28+
vault_uri: http://azure-vault.test
29+
name: azure
30+
prefix: my-azure-vault
31+
tags:
32+
- tag1
33+
- config:
34+
account: test-ac
35+
api_key: test-key
36+
auth_method: api_key
37+
base64_decode: false
38+
endpoint_url: http://example-server.test
39+
login: test-id
40+
name: conjur
41+
prefix: my-conjur-vault
42+
tags:
43+
- tag1
44+
- config:
45+
base64_decode: false
46+
prefix: TEST_
47+
name: env
48+
prefix: my-env-vault
49+
tags:
50+
- tag1
51+
- config:
52+
base64_decode: false
53+
project_id: test-123
54+
name: gcp
55+
prefix: my-gcp-vault
56+
tags:
57+
- tag1
58+
- config:
59+
auth_method: token
60+
base64_decode: false
61+
host: 127.0.0.1
62+
kube_auth_path: kubernetes
63+
kv: v1
64+
mount: secret
65+
port: 8200
66+
protocol: http
67+
token: example-token
68+
name: hcv
69+
prefix: my-hcv-vault1
70+
tags:
71+
- tag1
72+
- config:
73+
auth_method: kubernetes
74+
base64_decode: false
75+
host: 127.0.0.1
76+
kube_api_token_file: test-file
77+
kube_auth_path: kubernetes
78+
kube_role: test-role
79+
kv: v1
80+
mount: secret
81+
port: 8200
82+
protocol: http
83+
name: hcv
84+
prefix: my-hcv-vault2
85+
tags:
86+
- tag1
87+
- config:
88+
approle_response_wrapping: true
89+
approle_role_id: test-id-123
90+
approle_secret_id: test-secret-123
91+
auth_method: approle
92+
base64_decode: false
93+
host: 127.0.0.1
94+
kube_auth_path: kubernetes
95+
kv: v1
96+
mount: secret
97+
port: 8200
98+
protocol: http
99+
name: hcv
100+
prefix: my-hcv-vault3
101+
tags:
102+
- tag2

0 commit comments

Comments
 (0)