From d894ed1bc04aebf0c133b71dd8ac82f9c9390306 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Tue, 2 Dec 2025 15:41:30 +0530 Subject: [PATCH 1/7] tests: skip-defaults zero field tests --- go.mod | 2 +- go.sum | 4 ++-- .../009-skip-defaults/enterprise/3.4/plugin.expected.yaml | 1 + .../dump/009-skip-defaults/enterprise/3.4/plugin.yaml | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 7510e2d35..c8f0465b6 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/fatih/color v1.18.0 github.com/google/go-cmp v0.7.0 github.com/kong/go-apiops v0.2.1 - github.com/kong/go-database-reconciler v1.30.1 + github.com/kong/go-database-reconciler v1.30.2-0.20251202095128-60d0473d15c3 github.com/kong/go-kong v0.70.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.9.1 diff --git a/go.sum b/go.sum index 27cf1c8ec..70332a57c 100644 --- a/go.sum +++ b/go.sum @@ -244,8 +244,8 @@ github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/q github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/kong/go-apiops v0.2.1 h1:6HtyQyOj+CLA86iRtXA6rpTqemp7VqJJ6gpHyNHdB7o= github.com/kong/go-apiops v0.2.1/go.mod h1:yPwbl3P2eQinVGAEA0d3legaYmzPJ+WtJf9fSeGF4b8= -github.com/kong/go-database-reconciler v1.30.1 h1:ATSYQfyTTiOsWdfjxRjCZZ3nCGu/uQcjyquPuragn94= -github.com/kong/go-database-reconciler v1.30.1/go.mod h1:917AEJhlU+IbONlUIpAy2we3c1VzH94NKYN2bhRscb4= +github.com/kong/go-database-reconciler v1.30.2-0.20251202095128-60d0473d15c3 h1:jFUzZ1YAtjP/swnaPo+874pyH6paW9AKcY0aKLFlJ0g= +github.com/kong/go-database-reconciler v1.30.2-0.20251202095128-60d0473d15c3/go.mod h1:917AEJhlU+IbONlUIpAy2we3c1VzH94NKYN2bhRscb4= github.com/kong/go-kong v0.70.0 h1:Exug9do74koMme1F8T9kAI0k+ubPQqPDRyv/tGiVwC4= github.com/kong/go-kong v0.70.0/go.mod h1:J0vGB3wsZ2i99zly1zTRe3v7rOKpkhQZRwbcTFP76qM= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= diff --git a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.4/plugin.expected.yaml b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.4/plugin.expected.yaml index c2351aaad..e01ef494d 100644 --- a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.4/plugin.expected.yaml +++ b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.4/plugin.expected.yaml @@ -9,5 +9,6 @@ plugins: client_secret: - abcd issuer: http://example.com + session_redis_host: null enabled: true name: openid-connect diff --git a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.4/plugin.yaml b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.4/plugin.yaml index 092161f70..0a756207d 100644 --- a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.4/plugin.yaml +++ b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.4/plugin.yaml @@ -180,7 +180,7 @@ plugins: session_redis_cluster_max_redirections: null session_redis_cluster_nodes: null session_redis_connect_timeout: null - session_redis_host: 127.0.0.1 + session_redis_host: null session_redis_password: null session_redis_port: 6379 session_redis_prefix: null From dc9908b51a71a7cc7e9f519880a19c63f67e3865 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 3 Dec 2025 12:45:55 +0530 Subject: [PATCH 2/7] tests: added test cases for 3.12 --- tests/integration/dump_test.go | 20 ++++- .../3.10+/plugin-partial-2.expected.yaml | 5 ++ .../enterprise/3.10+/plugin-partial-2.yaml | 8 +- .../enterprise/3.10+/plugin-partial.yaml | 1 + .../3.12/consumer-group-scoped.expected.yaml | 38 ++++++++++ .../3.12/consumer-group-scoped.yaml | 76 +++++++++++++++++++ .../3.12/plugin-partial.expected.yaml | 28 +++++++ .../enterprise/3.12/plugin-partial.yaml | 63 +++++++++++++++ 8 files changed, 231 insertions(+), 8 deletions(-) create mode 100644 tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/consumer-group-scoped.expected.yaml create mode 100644 tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/consumer-group-scoped.yaml create mode 100644 tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/plugin-partial.expected.yaml create mode 100644 tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/plugin-partial.yaml diff --git a/tests/integration/dump_test.go b/tests/integration/dump_test.go index c22445a79..e1c84c94d 100644 --- a/tests/integration/dump_test.go +++ b/tests/integration/dump_test.go @@ -1002,16 +1002,28 @@ func Test_Dump_SkipDefaults(t *testing.T) { runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.4.0 <3.5.0") }, }, { - name: "dump skip-defaults: consumers, consumer-groups, consumer-group scoped plugins 3.10+", + name: "dump skip-defaults: consumers, consumer-groups, consumer-group scoped plugins >=3.10.0 <3.12.0", stateFile: "testdata/dump/009-skip-defaults/enterprise/3.10+/consumer-group-scoped.yaml", expectedFile: "testdata/dump/009-skip-defaults/enterprise/3.10+/consumer-group-scoped.expected.yaml", - runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.10.0") }, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.10.0 <3.12.0") }, + }, + { + name: "dump skip-defaults: consumers, consumer-groups, consumer-group scoped plugins >=3.12.0", + stateFile: "testdata/dump/009-skip-defaults/enterprise/3.12/consumer-group-scoped.yaml", + expectedFile: "testdata/dump/009-skip-defaults/enterprise/3.12/consumer-group-scoped.expected.yaml", + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.12.0") }, }, { - name: "dump skip-defaults: plugins, partials (rla) 3.10+", + name: "dump skip-defaults: plugins, partials (rla) >=3.10.0 <3.12.0", stateFile: "testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial.yaml", expectedFile: "testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial.expected.yaml", - runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.10.0") }, + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.10.0 <3.12.0") }, + }, + { + name: "dump skip-defaults: plugins, partials (rla) >=3.12.0", + stateFile: "testdata/dump/009-skip-defaults/enterprise/3.12/plugin-partial.yaml", + expectedFile: "testdata/dump/009-skip-defaults/enterprise/3.12/plugin-partial.expected.yaml", + runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.12.0") }, }, { name: "dump skip-defaults: plugins (openid-connect) 3.4+", diff --git a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial-2.expected.yaml b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial-2.expected.yaml index 71dcb8796..603fddb54 100644 --- a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial-2.expected.yaml +++ b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial-2.expected.yaml @@ -14,5 +14,10 @@ plugins: client_secret: - abc-secret issuer: http://example-issuer.com + redis: + host: null + port: null + session_redis_host: null + session_redis_port: null enabled: true name: openid-connect diff --git a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial-2.yaml b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial-2.yaml index 5f48fdcf6..f4e0a623b 100644 --- a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial-2.yaml +++ b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial-2.yaml @@ -217,11 +217,11 @@ plugins: connect_timeout: 2000 connection_is_proxied: false database: 0 - host: 127.0.0.1 + host: null keepalive_backlog: null keepalive_pool_size: 256 password: null - port: 6379 + port: null prefix: null read_timeout: 2000 send_timeout: 2000 @@ -287,9 +287,9 @@ plugins: session_redis_cluster_max_redirections: 5 session_redis_cluster_nodes: null session_redis_connect_timeout: 2000 - session_redis_host: 127.0.0.1 + session_redis_host: null session_redis_password: null - session_redis_port: 6379 + session_redis_port: null session_redis_prefix: null session_redis_read_timeout: 2000 session_redis_send_timeout: 2000 diff --git a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial.yaml b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial.yaml index fe81ee675..0f309030c 100644 --- a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial.yaml +++ b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial.yaml @@ -47,6 +47,7 @@ plugins: retry_after_jitter_max: 0 strategy: redis sync_rate: -1 + throttling: null window_size: - 100 window_type: sliding diff --git a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/consumer-group-scoped.expected.yaml b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/consumer-group-scoped.expected.yaml new file mode 100644 index 000000000..ef9c7ebaa --- /dev/null +++ b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/consumer-group-scoped.expected.yaml @@ -0,0 +1,38 @@ +_format_version: "3.0" +consumer_groups: +- name: foo + plugins: + - config: + limit: + - 10 + namespace: tPHO9qtcb99zWWUWxSVDQiUpb7kj59ZQ + redis: + host: example.com + strategy: redis + sync_rate: -1 + throttling: null + window_size: + - 100 + name: rate-limiting-advanced +consumers: +- acls: + - group: my-group + groups: + - name: foo + hmacauth_credentials: + - secret: abcd + username: c1 + keyauth_credentials: + - key: abcd + username: c1 +- groups: + - name: foo + jwt_secrets: + - algorithm: HS256 + key: abc + secret: abcd + tags: + - tag1 + tags: + - tag1 + username: c2 diff --git a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/consumer-group-scoped.yaml b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/consumer-group-scoped.yaml new file mode 100644 index 000000000..290768b49 --- /dev/null +++ b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/consumer-group-scoped.yaml @@ -0,0 +1,76 @@ +_format_version: "3.0" +consumer_groups: +- name: foo + plugins: + - config: + compound_identifier: null + consumer_groups: null + dictionary_name: kong_rate_limiting_counters + disable_penalty: false + enforce_consumer_groups: false + error_code: 429 + error_message: API rate limit exceeded + header_name: null + hide_client_headers: false + identifier: consumer + limit: + - 10 + lock_dictionary_name: kong_locks + namespace: tPHO9qtcb99zWWUWxSVDQiUpb7kj59ZQ + path: null + redis: + cluster_addresses: null + cluster_max_redirections: 5 + cluster_nodes: null + connect_timeout: 2000 + connection_is_proxied: false + database: 0 + host: example.com + keepalive_backlog: null + keepalive_pool_size: 256 + password: null + port: 6379 + read_timeout: 2000 + redis_proxy_type: null + send_timeout: 2000 + sentinel_addresses: null + sentinel_master: null + sentinel_nodes: null + sentinel_password: null + sentinel_role: null + sentinel_username: null + server_name: null + ssl: false + ssl_verify: false + timeout: 2000 + username: null + retry_after_jitter_max: 0 + strategy: redis + sync_rate: -1 + throttling: null + window_size: + - 100 + window_type: sliding + name: rate-limiting-advanced +consumers: +- acls: + - group: my-group + groups: + - name: foo + hmacauth_credentials: + - secret: abcd + username: c1 + keyauth_credentials: + - key: abcd + username: c1 +- groups: + - name: foo + jwt_secrets: + - algorithm: HS256 + key: abc + secret: abcd + tags: + - tag1 + tags: + - tag1 + username: c2 diff --git a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/plugin-partial.expected.yaml b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/plugin-partial.expected.yaml new file mode 100644 index 000000000..4ffce727e --- /dev/null +++ b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/plugin-partial.expected.yaml @@ -0,0 +1,28 @@ +_format_version: "3.0" +partials: +- config: + host: example.com + keepalive_backlog: 0 + password: redis-pass + username: redis-user + id: 65a8785d-2e4a-4adb-8805-63e1141219cd + name: my-partial-ee + tags: + - tag1 + type: redis-ee +plugins: +- config: + limit: + - 10 + namespace: 1jN8MwEfPOC5LEb4noafwYJEQiafdPnA + strategy: redis + sync_rate: -1 + throttling: null + window_size: + - 100 + enabled: true + name: rate-limiting-advanced + partials: + - id: 65a8785d-2e4a-4adb-8805-63e1141219cd + name: my-partial-ee + path: config.redis diff --git a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/plugin-partial.yaml b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/plugin-partial.yaml new file mode 100644 index 000000000..fe81ee675 --- /dev/null +++ b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.12/plugin-partial.yaml @@ -0,0 +1,63 @@ +_format_version: "3.0" +partials: +- config: + cluster_max_redirections: 5 + cluster_nodes: null + connect_timeout: 2000 + connection_is_proxied: false + database: 0 + host: example.com + keepalive_backlog: 0 + keepalive_pool_size: 256 + password: redis-pass + port: 6379 + read_timeout: 2000 + send_timeout: 2000 + sentinel_master: null + sentinel_nodes: null + sentinel_password: null + sentinel_role: null + sentinel_username: null + server_name: null + ssl: false + ssl_verify: false + username: redis-user + id: 65a8785d-2e4a-4adb-8805-63e1141219cd + name: my-partial-ee + tags: + - tag1 + type: redis-ee +plugins: +- config: + compound_identifier: null + consumer_groups: null + dictionary_name: kong_rate_limiting_counters + disable_penalty: false + enforce_consumer_groups: false + error_code: 429 + error_message: API rate limit exceeded + header_name: null + hide_client_headers: false + identifier: consumer + limit: + - 10 + lock_dictionary_name: kong_locks + namespace: 1jN8MwEfPOC5LEb4noafwYJEQiafdPnA + path: null + retry_after_jitter_max: 0 + strategy: redis + sync_rate: -1 + window_size: + - 100 + window_type: sliding + enabled: true + name: rate-limiting-advanced + partials: + - id: 65a8785d-2e4a-4adb-8805-63e1141219cd + name: my-partial-ee + path: config.redis + protocols: + - grpc + - grpcs + - http + - https From 6fe3a926573875feab1ad93250896c46c85e74ce Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 3 Dec 2025 13:22:08 +0530 Subject: [PATCH 3/7] tests: corrected testdata for 3.10, 3.11 --- .../dump/009-skip-defaults/enterprise/3.10+/plugin-partial.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial.yaml b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial.yaml index 0f309030c..fe81ee675 100644 --- a/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial.yaml +++ b/tests/integration/testdata/dump/009-skip-defaults/enterprise/3.10+/plugin-partial.yaml @@ -47,7 +47,6 @@ plugins: retry_after_jitter_max: 0 strategy: redis sync_rate: -1 - throttling: null window_size: - 100 window_type: sliding From eede21cd53e65b673e053640ace25e3700b83340 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 3 Dec 2025 13:35:18 +0530 Subject: [PATCH 4/7] tests: konnect tests correction --- .../konnect/consumer-group-scoped.expected.yaml | 2 ++ .../009-skip-defaults/konnect/plugin-partial-2.expected.yaml | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml b/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml index 41f3ed30e..bc1856c97 100644 --- a/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml +++ b/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml @@ -9,9 +9,11 @@ consumer_groups: - 10 namespace: tPHO9qtcb99zWWUWxSVDQiUpb7kj59ZQ redis: + cloud_authentication: null host: example.com strategy: redis sync_rate: -1 + throttling: null window_size: - 100 name: rate-limiting-advanced diff --git a/tests/integration/testdata/dump/009-skip-defaults/konnect/plugin-partial-2.expected.yaml b/tests/integration/testdata/dump/009-skip-defaults/konnect/plugin-partial-2.expected.yaml index e0132719d..28f711386 100644 --- a/tests/integration/testdata/dump/009-skip-defaults/konnect/plugin-partial-2.expected.yaml +++ b/tests/integration/testdata/dump/009-skip-defaults/konnect/plugin-partial-2.expected.yaml @@ -15,6 +15,10 @@ plugins: - abc-client client_secret: - abc-secret + cluster_cache_redis: + cloud_authentication: null issuer: http://example-issuer.com + redis: + cloud_authentication: null enabled: true name: openid-connect From 9a75f17916a7eadfa1be8af87de9edafc105dbac Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 3 Dec 2025 13:45:08 +0530 Subject: [PATCH 5/7] tests: konnect integration test correction --- .../konnect/consumer-group-scoped.expected.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml b/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml index bc1856c97..0d4d4289f 100644 --- a/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml +++ b/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml @@ -13,7 +13,6 @@ consumer_groups: host: example.com strategy: redis sync_rate: -1 - throttling: null window_size: - 100 name: rate-limiting-advanced From bca77d8613c80f059f6af392493e2a87b4976536 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 3 Dec 2025 14:11:18 +0530 Subject: [PATCH 6/7] tests: konnect integration test correction --- .../konnect/consumer-group-scoped.expected.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml b/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml index 0d4d4289f..bc1856c97 100644 --- a/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml +++ b/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.expected.yaml @@ -13,6 +13,7 @@ consumer_groups: host: example.com strategy: redis sync_rate: -1 + throttling: null window_size: - 100 name: rate-limiting-advanced From d4fc6de9edca1741e32d2d7f977b2203ac37d934 Mon Sep 17 00:00:00 2001 From: Prashansa Kulshrestha Date: Wed, 3 Dec 2025 14:24:27 +0530 Subject: [PATCH 7/7] tests: konnect integration test correction --- .../009-skip-defaults/konnect/consumer-group-scoped.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.yaml b/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.yaml index 7e6484f27..313792ac8 100644 --- a/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.yaml +++ b/tests/integration/testdata/dump/009-skip-defaults/konnect/consumer-group-scoped.yaml @@ -49,11 +49,7 @@ consumer_groups: retry_after_jitter_max: 0 strategy: redis sync_rate: -1 - throttling: - enabled: false - interval: 5 - queue_limit: 5 - retry_times: 3 + throttling: null window_size: - 100 window_type: sliding