Skip to content

Commit

Permalink
tests(clustering): start/stop when incremental on (#13852)
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw authored Nov 11, 2024
1 parent 08a7730 commit a1a6f63
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions spec/02-integration/09-hybrid_mode/02-start_stop_spec.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
local helpers = require "spec.helpers"


describe("invalid config are rejected", function()
for _, inc_sync in ipairs { "on", "off" } do
describe("invalid config are rejected" .. " inc_sync=" .. inc_sync, function()
describe("role is control_plane", function()
it("can not disable admin_listen", function()
local ok, err = helpers.start_kong({
Expand All @@ -11,6 +12,7 @@ describe("invalid config are rejected", function()
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_cert_key = "spec/fixtures/kong_clustering.key",
admin_listen = "off",
cluster_incremental_sync = inc_sync,
})

assert.False(ok)
Expand All @@ -25,6 +27,7 @@ describe("invalid config are rejected", function()
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_listen = "off",
cluster_incremental_sync = inc_sync,
})

assert.False(ok)
Expand All @@ -39,6 +42,7 @@ describe("invalid config are rejected", function()
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_cert_key = "spec/fixtures/kong_clustering.key",
database = "off",
cluster_incremental_sync = inc_sync,
})

assert.False(ok)
Expand All @@ -53,6 +57,7 @@ describe("invalid config are rejected", function()
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_mtls = "pki",
cluster_incremental_sync = inc_sync,
})

assert.False(ok)
Expand All @@ -69,6 +74,7 @@ describe("invalid config are rejected", function()
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_cert_key = "spec/fixtures/kong_clustering.key",
proxy_listen = "off",
cluster_incremental_sync = inc_sync,
})

assert.False(ok)
Expand All @@ -82,6 +88,7 @@ describe("invalid config are rejected", function()
prefix = "servroot2",
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_incremental_sync = inc_sync,
})

assert.False(ok)
Expand All @@ -97,7 +104,8 @@ describe("invalid config are rejected", function()
prefix = "servroot2",
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_dp_labels = "w@:_a"
cluster_dp_labels = "w@:_a",
cluster_incremental_sync = inc_sync,
})

assert.False(ok)
Expand All @@ -113,7 +121,8 @@ describe("invalid config are rejected", function()
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_cert_key = "spec/fixtures/kong_clustering.key",
proxy_listen = "0.0.0.0:" .. helpers.get_available_port(),
cluster_dp_labels = "Aa-._zZ_key:Aa-._zZ_val"
cluster_dp_labels = "Aa-._zZ_key:Aa-._zZ_val",
cluster_incremental_sync = inc_sync,
})
assert.True(ok)
helpers.stop_kong("servroot2")
Expand All @@ -128,6 +137,7 @@ describe("invalid config are rejected", function()
nginx_conf = "spec/fixtures/custom_nginx.template",
database = param[2],
prefix = "servroot2",
cluster_incremental_sync = inc_sync,
})

assert.False(ok)
Expand All @@ -141,6 +151,7 @@ describe("invalid config are rejected", function()
database = param[2],
prefix = "servroot2",
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_incremental_sync = inc_sync,
})

assert.False(ok)
Expand All @@ -151,7 +162,7 @@ describe("invalid config are rejected", function()
end)

-- note that lagacy modes still error when CP exits
describe("when CP exits before DP", function()
describe("when CP exits before DP" .. " inc_sync=" .. inc_sync, function()
local need_exit = true

lazy_setup(function()
Expand All @@ -164,6 +175,7 @@ describe("when CP exits before DP", function()
cluster_cert = "spec/fixtures/kong_clustering.crt",
cluster_cert_key = "spec/fixtures/kong_clustering.key",
cluster_listen = "127.0.0.1:9005",
cluster_incremental_sync = inc_sync,
}))
assert(helpers.start_kong({
role = "data_plane",
Expand All @@ -173,6 +185,7 @@ describe("when CP exits before DP", function()
cluster_control_plane = "127.0.0.1:9005",
proxy_listen = "0.0.0.0:9002",
database = "off",
cluster_incremental_sync = inc_sync,
-- EE [[
-- vitals uses the clustering strategy by default, and it logs the exact
-- same "error while receiving frame from peer" error strings that this
Expand All @@ -196,3 +209,4 @@ describe("when CP exits before DP", function()
assert.logfile("servroot2/logs/error.log").has.no.line("error while receiving frame from peer", true)
end)
end)
end -- for inc_sync

1 comment on commit a1a6f63

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:a1a6f6307106225e032ee8fdd98926b6ce061629
Artifacts available https://github.com/Kong/kong/actions/runs/11774318182

Please sign in to comment.