diff --git a/.github/workflows/integration-enterprise.yaml b/.github/workflows/integration-enterprise.yaml index 24b253c4a..a3e20551d 100644 --- a/.github/workflows/integration-enterprise.yaml +++ b/.github/workflows/integration-enterprise.yaml @@ -33,6 +33,7 @@ jobs: - 'kong/kong-gateway:3.12' - 'kong/kong-gateway:3.13' - 'kong/kong-gateway:3.14' + - 'kong/kong-gateway:3.15' - 'kong/kong-gateway-dev:latest' router_flavor: - 'traditional_compatible' diff --git a/tests/integration/dump_test.go b/tests/integration/dump_test.go index e1d3b0a31..974e30bca 100644 --- a/tests/integration/dump_test.go +++ b/tests/integration/dump_test.go @@ -1577,6 +1577,11 @@ func Test_Dump_ClonedPluginDefinitions(t *testing.T) { runWhen(t, tc.runWhen, tc.runWhenVersion) reset(t) + // Sync the plugin definitions first, in a separate run, so Kong + // has them registered before any plugin references them. + require.NoError(t, sync(ctx, + "testdata/sync/054-cloned-plugin-definitions/plugin-definitions.yaml", + "--include-plugin-definitions")) require.NoError(t, sync(ctx, "testdata/sync/054-cloned-plugin-definitions/kong.yaml", "--include-plugin-definitions")) @@ -1634,6 +1639,14 @@ func Test_Dump_CustomPluginDefinitions(t *testing.T) { runWhen(t, tc.runWhen, tc.runWhenVersion) reset(t) + // Sync the plugin definitions first, in a separate run, so Kong + // has them registered before any plugin references them. Doing + // this in a single sync is racy: a plugin may be created before + // its (custom) definition is ready, yielding an intermittent + // 404 "No plugin named ''". + require.NoError(t, sync(ctx, + "testdata/sync/055-custom-plugin-definitions/plugin-definitions.yaml", + "--include-plugin-definitions")) require.NoError(t, sync(ctx, "testdata/sync/055-custom-plugin-definitions/kong.yaml", "--include-plugin-definitions")) diff --git a/tests/integration/testdata/sync/054-cloned-plugin-definitions/plugin-definitions.yaml b/tests/integration/testdata/sync/054-cloned-plugin-definitions/plugin-definitions.yaml new file mode 100644 index 000000000..34edc020d --- /dev/null +++ b/tests/integration/testdata/sync/054-cloned-plugin-definitions/plugin-definitions.yaml @@ -0,0 +1,15 @@ +_format_version: "3.0" +cloned_plugins: +- name: new-file-log + ref: file-log + priority: 100 + tags: + - tag1 + - tag2 + - select-me +- name: new-acl + ref: acl + priority: 1000 + tags: + - tag1 + - tag2 diff --git a/tests/integration/testdata/sync/055-custom-plugin-definitions/plugin-definitions.yaml b/tests/integration/testdata/sync/055-custom-plugin-definitions/plugin-definitions.yaml new file mode 100644 index 000000000..f5f088612 --- /dev/null +++ b/tests/integration/testdata/sync/055-custom-plugin-definitions/plugin-definitions.yaml @@ -0,0 +1,37 @@ +_format_version: "3.0" +custom_plugins: +- name: set-header + handler: | + return { + VERSION = "1.0,0", + PRIORITY = 500, + access = function(self, config) + kong.service.request.set_header(config.name, config.value) + end + } + schema: | + return { + name = "set-header", + fields = { + { protocols = require("kong.db.schema.typedefs").protocols_http }, + { + config = { + type = "record", + fields = { + { name = { description = "The name of the header to set.", type = "string", required = true, }, }, + { value = { description = "The value for the header.", type = "string", required = true, }, }, + }, + }, + }, + }, + } + tags: + - tag1 + - tag2 + - select-me +- name: col-dbless + handler: 'return { PRIORITY = 1000, VERSION = "1.0.0" }' + schema: 'return { name = "col-dbless", fields = { { config = { type = "record", fields = {} } } } }' + tags: + - tag1 + - tag2