Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tests): add lock_dictionary_name to expected Konnect state #1449

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion kong2kic/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ func createIngressPaths(
if *servicePort > 65535 || *servicePort < 0 {
log.Fatalf("Port %d is not within the valid range. Please provide a port between 0 and 65535.\n", *servicePort)
}
//nolint: gosec
backend.Service.Port.Number = int32(*servicePort)
}
paths = append(paths, k8snetv1.HTTPIngressPath{
Expand Down
167 changes: 166 additions & 1 deletion tests/integration/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,171 @@ var (
},
}

consumerGroupScopedPluginsKonnect = []*kong.Plugin{
{
Name: kong.String("rate-limiting-advanced"),
ConsumerGroup: &kong.ConsumerGroup{
ID: kong.String("77e6691d-67c0-446a-9401-27be2b141aae"),
},
Config: kong.Configuration{
"consumer_groups": nil,
"dictionary_name": string("kong_rate_limiting_counters"),
"disable_penalty": bool(false),
"enforce_consumer_groups": bool(false),
"error_code": float64(429),
"error_message": string("API rate limit exceeded"),
"header_name": nil,
"hide_client_headers": bool(false),
"identifier": string("consumer"),
"limit": []any{float64(10)},
"lock_dictionary_name": string("kong_locks"),
"namespace": string("gold"),
"path": nil,
"redis": map[string]any{
"cluster_addresses": nil,
"connect_timeout": nil,
"database": float64(0),
"host": nil,
"keepalive_backlog": nil,
"keepalive_pool_size": float64(256),
"password": nil,
"port": nil,
"read_timeout": nil,
"send_timeout": nil,
"sentinel_addresses": nil,
"sentinel_master": nil,
"sentinel_password": nil,
"sentinel_role": nil,
"sentinel_username": nil,
"server_name": nil,
"ssl": false,
"ssl_verify": false,
"timeout": float64(2000),
"username": nil,
},
"retry_after_jitter_max": float64(1),
"strategy": string("local"),
"sync_rate": float64(-1),
"window_size": []any{float64(60)},
"window_type": string("sliding"),
},
Enabled: kong.Bool(true),
Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")},
},
{
Name: kong.String("rate-limiting-advanced"),
ConsumerGroup: &kong.ConsumerGroup{
ID: kong.String("5bcbd3a7-030b-4310-bd1d-2721ff85d236"),
},
Config: kong.Configuration{
"consumer_groups": nil,
"dictionary_name": string("kong_rate_limiting_counters"),
"disable_penalty": bool(false),
"enforce_consumer_groups": bool(false),
"error_code": float64(429),
"error_message": string("API rate limit exceeded"),
"header_name": nil,
"hide_client_headers": bool(false),
"identifier": string("consumer"),
"limit": []any{float64(7)},
"lock_dictionary_name": string("kong_locks"),
"namespace": string("silver"),
"path": nil,
"redis": map[string]any{
"cluster_addresses": nil,
"connect_timeout": nil,
"database": float64(0),
"host": nil,
"keepalive_backlog": nil,
"keepalive_pool_size": float64(256),
"password": nil,
"port": nil,
"read_timeout": nil,
"send_timeout": nil,
"sentinel_addresses": nil,
"sentinel_master": nil,
"sentinel_password": nil,
"sentinel_role": nil,
"sentinel_username": nil,
"server_name": nil,
"ssl": false,
"ssl_verify": false,
"timeout": float64(2000),
"username": nil,
},
"retry_after_jitter_max": float64(1),
"strategy": string("local"),
"sync_rate": float64(-1),
"window_size": []any{float64(60)},
"window_type": string("sliding"),
},
Enabled: kong.Bool(true),
Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")},
},
{
Name: kong.String("rate-limiting-advanced"),
Config: kong.Configuration{
"consumer_groups": nil,
"dictionary_name": string("kong_rate_limiting_counters"),
"disable_penalty": bool(false),
"enforce_consumer_groups": bool(false),
"error_code": float64(429),
"error_message": string("API rate limit exceeded"),
"header_name": nil,
"hide_client_headers": bool(false),
"identifier": string("consumer"),
"limit": []any{float64(5)},
"lock_dictionary_name": string("kong_locks"),
"namespace": string("silver"),
"path": nil,
"redis": map[string]any{
"cluster_addresses": nil,
"connect_timeout": nil,
"database": float64(0),
"host": nil,
"keepalive_backlog": nil,
"keepalive_pool_size": float64(256),
"password": nil,
"port": nil,
"read_timeout": nil,
"send_timeout": nil,
"sentinel_addresses": nil,
"sentinel_master": nil,
"sentinel_password": nil,
"sentinel_role": nil,
"sentinel_username": nil,
"server_name": nil,
"ssl": false,
"ssl_verify": false,
"timeout": float64(2000),
"username": nil,
},
"retry_after_jitter_max": float64(1),
"strategy": string("local"),
"sync_rate": float64(-1),
"window_size": []any{float64(60)},
"window_type": string("sliding"),
},
Enabled: kong.Bool(true),
Protocols: []*string{kong.String("grpc"), kong.String("grpcs"), kong.String("http"), kong.String("https")},
},
{
Name: kong.String("key-auth"),
Config: kong.Configuration{
"anonymous": nil,
"hide_credentials": false,
"key_in_body": false,
"key_in_header": true,
"key_in_query": true,
"key_names": []interface{}{"apikey"},
"realm": nil, // This is present on 3.7.x+
"run_on_preflight": true,
},
Enabled: kong.Bool(true),
Protocols: []*string{kong.String("http"), kong.String("https")},
},
}

consumerGroupScopedPlugins381x = []*kong.Plugin{
{
Name: kong.String("rate-limiting-advanced"),
Expand Down Expand Up @@ -5074,7 +5239,7 @@ func Test_Sync_ConsumerGroupsScopedPluginsKonnect(t *testing.T) {
},
},
},
Plugins: consumerGroupScopedPlugins37x,
Plugins: consumerGroupScopedPluginsKonnect,
Services: svc1_207,
Routes: route1_20x,
KeyAuths: []*kong.KeyAuth{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ consumer_groups:
identifier: consumer
limit:
- 30000
lock_dictionary_name: kong_locks
namespace: basic
path: null
redis:
Expand Down
Loading