Skip to content

Commit

Permalink
tests: fix plugin config defaults test
Browse files Browse the repository at this point in the history
  • Loading branch information
flrgh committed Mar 26, 2024
1 parent b52a780 commit d0e1d08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions kong/plugin_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,6 @@ func TestFillPluginDefaults(T *testing.T) {
SkipWhenEnterprise(T)
RunWhenKong(T, ">=2.3.0")

// FIXME: this test needs to be more version-aware due to new fields added 3.7
RunWhenKong(T, "<3.7.0")

client, err := NewTestClient(nil, nil)
require.NoError(T, err)
require.NotNil(T, client)
Expand All @@ -566,15 +563,15 @@ func TestFillPluginDefaults(T *testing.T) {
{
name: "no config no protocols",
plugin: &Plugin{
Name: String("basic-auth"),
Name: String("bot-detection"),
RunOn: String("test"),
},
expected: &Plugin{
Name: String("basic-auth"),
Name: String("bot-detection"),
RunOn: String("test"),
Config: Configuration{
"anonymous": nil,
"hide_credentials": false,
"allow": []interface{}{},
"deny": []interface{}{},
},
Protocols: []*string{String("grpc"), String("grpcs"), String("http"), String("https")},
Enabled: Bool(true),
Expand All @@ -583,22 +580,23 @@ func TestFillPluginDefaults(T *testing.T) {
{
name: "partial config no protocols",
plugin: &Plugin{
Name: String("basic-auth"),
Name: String("file-log"),
Consumer: &Consumer{
ID: String("3bb9a73c-a467-11ec-b909-0242ac120002"),
},
Config: Configuration{
"hide_credentials": true,
"path": String("log.txt"),
},
},
expected: &Plugin{
Name: String("basic-auth"),
Name: String("file-log"),
Consumer: &Consumer{
ID: String("3bb9a73c-a467-11ec-b909-0242ac120002"),
},
Config: Configuration{
"anonymous": nil,
"hide_credentials": true,
"path": "log.txt",
"reopen": false,
"custom_fields_by_lua": nil,
},
Protocols: []*string{String("grpc"), String("grpcs"), String("http"), String("https")},
Enabled: Bool(true),
Expand Down
2 changes: 1 addition & 1 deletion kong/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func SkipWhenEnterprise(t *testing.T) {
}

if currentVersion.IsKongGatewayEnterprise() {
t.Skip("non-Enterprise test Kong instance, skipping")
t.Skip("Enterprise test Kong instance, skipping")
}
}

Expand Down

0 comments on commit d0e1d08

Please sign in to comment.