Skip to content

Commit 3819f38

Browse files
committed
fix: basic-auths dump with skip-defaults
1 parent 7f83509 commit 3819f38

File tree

7 files changed

+188
-3
lines changed

7 files changed

+188
-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.2
17-
github.com/kong/go-database-reconciler v1.31.4
17+
github.com/kong/go-database-reconciler v1.31.5-0.20260212075957-03ff2f3828b1
1818
github.com/kong/go-kong v0.72.1
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.2 h1:Owdcl/PxTdtciqyZKgPScVhTKHgY2b8dGIC1Bms8NpI=
246246
github.com/kong/go-apiops v0.2.2/go.mod h1:yPwbl3P2eQinVGAEA0d3legaYmzPJ+WtJf9fSeGF4b8=
247-
github.com/kong/go-database-reconciler v1.31.4 h1:F1/8gE68Gqo+BwRaJA/owv/UBfEau03Q7Zjzy+H2Eac=
248-
github.com/kong/go-database-reconciler v1.31.4/go.mod h1:A6BBhnK1AQ7mQAsnLHoAitS62nJRGqUI8NbjC1aRGOc=
247+
github.com/kong/go-database-reconciler v1.31.5-0.20260212075957-03ff2f3828b1 h1:/om/qox0I6iYiHSQFWBzMf+qUU9+mbAI9sZZV7/bpzw=
248+
github.com/kong/go-database-reconciler v1.31.5-0.20260212075957-03ff2f3828b1/go.mod h1:A6BBhnK1AQ7mQAsnLHoAitS62nJRGqUI8NbjC1aRGOc=
249249
github.com/kong/go-kong v0.72.1 h1:rQ69f3Wd0Fvc3JANkavo34vePqR4uZG/YQ2y5U7d2Po=
250250
github.com/kong/go-kong v0.72.1/go.mod h1:J0vGB3wsZ2i99zly1zTRe3v7rOKpkhQZRwbcTFP76qM=
251251
github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY=

tests/integration/dump_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,11 @@ func Test_Dump_SkipDefaults_Konnect(t *testing.T) {
938938
stateFile: "testdata/dump/009-skip-defaults/konnect/vaults.yaml",
939939
expectedFile: "testdata/dump/009-skip-defaults/konnect/vaults.expected.yaml",
940940
},
941+
{
942+
name: "dump skip-defaults: credentials",
943+
stateFile: "testdata/dump/009-skip-defaults/konnect/credentials.yaml",
944+
expectedFile: "testdata/dump/009-skip-defaults/konnect/credentials.expected.yaml",
945+
},
941946
}
942947

943948
for _, tc := range tests {
@@ -1056,6 +1061,12 @@ func Test_Dump_SkipDefaults(t *testing.T) {
10561061
expectedFile: "testdata/dump/009-skip-defaults/enterprise/3.11+/vaults.expected.yaml",
10571062
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.11.0") },
10581063
},
1064+
{
1065+
name: "credentials skip-defaults 3.4+",
1066+
stateFile: "testdata/dump/009-skip-defaults/enterprise/3.4/credentials.yaml",
1067+
expectedFile: "testdata/dump/009-skip-defaults/enterprise/3.4/credentials.expected.yaml",
1068+
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.4.0") },
1069+
},
10591070
}
10601071

10611072
for _, tc := range tests {
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
_format_version: "3.0"
2+
consumers:
3+
- acls:
4+
- group: acl-group-1
5+
id: b46ef451-1d71-4c38-a036-e49110303ac5
6+
tags:
7+
- managed-by-deck
8+
basicauth_credentials:
9+
- id: eae0f644-d34f-4a28-a8ff-485081952d34
10+
password: 03f0e5791d4296fb9b19db91586c79dcb5f82f9a
11+
tags:
12+
- managed-by-deck
13+
username: c1
14+
hmacauth_credentials:
15+
- id: 5bb1660e-548f-4520-b5f0-8a93bd2ffc3d
16+
secret: yeNZBeqCuk0D3H85VX77Umacf91MwqRo
17+
tags:
18+
- managed-by-deck
19+
username: c1
20+
id: 14a1653f-444e-49d4-9418-038241583244
21+
jwt_secrets:
22+
- algorithm: HS256
23+
id: c42df29f-a9cc-4798-b560-76a0e9df561b
24+
key: MKWeR0nu9OAUR9HrjpUG82Hbfz7ZXsIw
25+
secret: 6gkrxTKAraykMSpmnLNEGiEE3Yz8XL6U
26+
tags:
27+
- managed-by-deck
28+
keyauth_credentials:
29+
- id: 43b112b6-4795-41ec-ad24-9615c647efc1
30+
key: iwb6Djkk4HhUlOCmLilDIKh6nZrn90ts
31+
tags:
32+
- managed-by-deck
33+
mtls_auth_credentials:
34+
- id: bda09448-3b10-4da7-a83b-2a8ba6021f0c
35+
subject_name: test@example.com
36+
oauth2_credentials:
37+
- client_id: my-id
38+
client_secret: my-secret
39+
id: af6ebe88-ae89-4ebb-81a2-e56feff243db
40+
name: my-oauth-cred
41+
tags:
42+
- managed-by-deck
43+
tags:
44+
- bar
45+
username: c1
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
_format_version: "3.0"
2+
consumers:
3+
- id: 14a1653f-444e-49d4-9418-038241583244
4+
username: c1
5+
tags:
6+
- bar
7+
acls:
8+
- id: b46ef451-1d71-4c38-a036-e49110303ac5
9+
group: acl-group-1
10+
tags:
11+
- managed-by-deck
12+
basicauth_credentials:
13+
- id: eae0f644-d34f-4a28-a8ff-485081952d34
14+
password: 1aa4ed9059d4d97bf4575aad4ea2058d6e5e8f35
15+
tags:
16+
- managed-by-deck
17+
username: c1
18+
hmacauth_credentials:
19+
- id: 5bb1660e-548f-4520-b5f0-8a93bd2ffc3d
20+
secret: yeNZBeqCuk0D3H85VX77Umacf91MwqRo
21+
tags:
22+
- managed-by-deck
23+
username: c1
24+
jwt_secrets:
25+
- id: c42df29f-a9cc-4798-b560-76a0e9df561b
26+
algorithm: HS256
27+
key: MKWeR0nu9OAUR9HrjpUG82Hbfz7ZXsIw
28+
secret: 6gkrxTKAraykMSpmnLNEGiEE3Yz8XL6U
29+
tags:
30+
- managed-by-deck
31+
keyauth_credentials:
32+
- id: 43b112b6-4795-41ec-ad24-9615c647efc1
33+
key: iwb6Djkk4HhUlOCmLilDIKh6nZrn90ts
34+
tags:
35+
- managed-by-deck
36+
mtls_auth_credentials:
37+
- id: bda09448-3b10-4da7-a83b-2a8ba6021f0c
38+
subject_name: test@example.com
39+
oauth2_credentials:
40+
- id: af6ebe88-ae89-4ebb-81a2-e56feff243db
41+
client_id: my-id
42+
client_secret: my-secret
43+
client_type: confidential
44+
hash_secret: false
45+
name: my-oauth-cred
46+
tags:
47+
- managed-by-deck
48+
49+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
_format_version: "3.0"
2+
_konnect:
3+
control_plane_name: default
4+
consumers:
5+
- acls:
6+
- group: acl-group-1
7+
id: b46ef451-1d71-4c38-a036-e49110303ac5
8+
tags:
9+
- managed-by-deck
10+
basicauth_credentials:
11+
- id: eae0f644-d34f-4a28-a8ff-485081952d34
12+
password: 03f0e5791d4296fb9b19db91586c79dcb5f82f9a
13+
tags:
14+
- managed-by-deck
15+
username: c1
16+
hmacauth_credentials:
17+
- id: 5bb1660e-548f-4520-b5f0-8a93bd2ffc3d
18+
secret: yeNZBeqCuk0D3H85VX77Umacf91MwqRo
19+
tags:
20+
- managed-by-deck
21+
username: c1
22+
id: 14a1653f-444e-49d4-9418-038241583244
23+
jwt_secrets:
24+
- algorithm: HS256
25+
id: c42df29f-a9cc-4798-b560-76a0e9df561b
26+
key: MKWeR0nu9OAUR9HrjpUG82Hbfz7ZXsIw
27+
secret: 6gkrxTKAraykMSpmnLNEGiEE3Yz8XL6U
28+
tags:
29+
- managed-by-deck
30+
keyauth_credentials:
31+
- id: 43b112b6-4795-41ec-ad24-9615c647efc1
32+
key: iwb6Djkk4HhUlOCmLilDIKh6nZrn90ts
33+
tags:
34+
- managed-by-deck
35+
mtls_auth_credentials:
36+
- id: bda09448-3b10-4da7-a83b-2a8ba6021f0c
37+
subject_name: test@example.com
38+
tags:
39+
- bar
40+
username: c1
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
_format_version: "3.0"
2+
consumers:
3+
- id: 14a1653f-444e-49d4-9418-038241583244
4+
username: c1
5+
tags:
6+
- bar
7+
acls:
8+
- id: b46ef451-1d71-4c38-a036-e49110303ac5
9+
group: acl-group-1
10+
tags:
11+
- managed-by-deck
12+
basicauth_credentials:
13+
- id: eae0f644-d34f-4a28-a8ff-485081952d34
14+
password: 1aa4ed9059d4d97bf4575aad4ea2058d6e5e8f35
15+
tags:
16+
- managed-by-deck
17+
username: c1
18+
hmacauth_credentials:
19+
- id: 5bb1660e-548f-4520-b5f0-8a93bd2ffc3d
20+
secret: yeNZBeqCuk0D3H85VX77Umacf91MwqRo
21+
tags:
22+
- managed-by-deck
23+
username: c1
24+
jwt_secrets:
25+
- id: c42df29f-a9cc-4798-b560-76a0e9df561b
26+
algorithm: HS256
27+
key: MKWeR0nu9OAUR9HrjpUG82Hbfz7ZXsIw
28+
secret: 6gkrxTKAraykMSpmnLNEGiEE3Yz8XL6U
29+
tags:
30+
- managed-by-deck
31+
keyauth_credentials:
32+
- id: 43b112b6-4795-41ec-ad24-9615c647efc1
33+
key: iwb6Djkk4HhUlOCmLilDIKh6nZrn90ts
34+
tags:
35+
- managed-by-deck
36+
mtls_auth_credentials:
37+
- id: bda09448-3b10-4da7-a83b-2a8ba6021f0c
38+
subject_name: test@example.com
39+
40+

0 commit comments

Comments
 (0)