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

tests(integration): fix flakiness #12580

Merged
merged 4 commits into from
Feb 19, 2024
Merged

tests(integration): fix flakiness #12580

merged 4 commits into from
Feb 19, 2024

Conversation

ADD-SP
Copy link
Contributor

@ADD-SP ADD-SP commented Feb 19, 2024

Please REBASE and MERGE

Summary

The dynamic test scheduler exposed some issues by disrupting the order of the tests, some of which did not initialize the database or wrote incompatible data to the database, causing the Gateway instance to fail to start and causing the following test to fail.

Starting a Gateway instance even if it's not needed

  • spec/03-plugins/39-ai-request-transformer/01-transformer_spec.lua
  • spec/03-plugins/40-ai-response-transformer/01-transformer_spec.lua

These two test sets start a Gateway instance to launch a mocking server, which can be replaced by the spec.helpers.http_mock.

The database was not initialized before starting the Gateway instance

  • spec/02-integration/09-hybrid_mode/02-start_stop_spec.lua

Starting a service using a fixed port instead of a random port

Since the test sequence is disrupted and the port release is not real-time, this may cause the port to be occupied to the point where the test fails.

Checklist

Issue reference

KAG-3746

@ADD-SP ADD-SP added the cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee label Feb 19, 2024
@pull-request-size pull-request-size bot added size/L and removed size/M labels Feb 19, 2024
@ADD-SP ADD-SP changed the title tests: start mocking server with random port instead of fixed port tests: fix flakiness Feb 19, 2024
ADD-SP and others added 3 commits February 19, 2024 06:30
Some tests might change the DB in front of this test,
which causes incompatible data to prevent the CP from starting up.

describe(PLUGIN_NAME .. ": (unit)", function()
local mock
local mock_response_file = pl_path.abspath(
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note to myself: perhaps we could add a new API to use a file as the response for http_mock.

@ADD-SP ADD-SP merged commit acffb9d into master Feb 19, 2024
33 checks passed
@ADD-SP ADD-SP deleted the add-sp/tests-fix-flakiness branch February 19, 2024 08:06
@team-gateway-bot
Copy link
Collaborator

Cherry-pick failed for master, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git remote add upstream https://github.com/kong/kong-ee
git fetch upstream master
git worktree add -d .worktree/cherry-pick-12580-to-master-to-upstream upstream/master
cd .worktree/cherry-pick-12580-to-master-to-upstream
git checkout -b cherry-pick-12580-to-master-to-upstream
ancref=$(git merge-base 84cb1be01d8e9a241e8a2b3afd6d55bb184e605b 2f2cd079dcb0bd179b1faea27cd49ad64cd69dca)
git cherry-pick -x $ancref..2f2cd079dcb0bd179b1faea27cd49ad64cd69dca

@team-gateway-bot
Copy link
Collaborator

Successfully created backport PR for release/3.6.x:

@team-gateway-bot
Copy link
Collaborator

Cherry-pick failed for master, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git remote add upstream https://github.com/kong/kong-ee
git fetch upstream master
git worktree add -d .worktree/cherry-pick-12580-to-master-to-upstream upstream/master
cd .worktree/cherry-pick-12580-to-master-to-upstream
git checkout -b cherry-pick-12580-to-master-to-upstream
ancref=$(git merge-base 84cb1be01d8e9a241e8a2b3afd6d55bb184e605b 2f2cd079dcb0bd179b1faea27cd49ad64cd69dca)
git cherry-pick -x $ancref..2f2cd079dcb0bd179b1faea27cd49ad64cd69dca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants