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

[NoQA] e2e: exclude warmup results from final measurements #43023

Merged
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
11 changes: 11 additions & 0 deletions tests/e2e/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type ServerInstance = {
addTestResultListener: AddListener<TestResultListener>;
addTestDoneListener: AddListener<TestDoneListener>;
forceTestCompletion: () => void;
setReadyToAcceptTestResults: (isReady: boolean) => void;
start: () => Promise<void>;
stop: () => Promise<Error | undefined>;
};
Expand Down Expand Up @@ -96,6 +97,11 @@ const createServerInstance = (): ServerInstance => {
const [testStartedListeners, addTestStartedListener] = createListenerState<TestStartedListener>();
const [testResultListeners, addTestResultListener] = createListenerState<TestResultListener>();
const [testDoneListeners, addTestDoneListener] = createListenerState<TestDoneListener>();
let isReadyToAcceptTestResults = true;

const setReadyToAcceptTestResults = (isReady: boolean) => {
isReadyToAcceptTestResults = isReady;
};

const forceTestCompletion = () => {
testDoneListeners.forEach((listener) => {
Expand All @@ -122,6 +128,10 @@ const createServerInstance = (): ServerInstance => {
}

case Routes.testResults: {
if (!isReadyToAcceptTestResults) {
return res.end('ok');
}

getPostJSONRequestData<TestResult>(req, res)?.then((data) => {
if (!data) {
// The getPostJSONRequestData function already handled the response
Expand Down Expand Up @@ -201,6 +211,7 @@ const createServerInstance = (): ServerInstance => {
});

return {
setReadyToAcceptTestResults,
setTestConfig,
addTestStartedListener,
addTestResultListener,
Expand Down
3 changes: 3 additions & 0 deletions tests/e2e/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ const runTests = async (): Promise<void> => {
await sleep(config.BOOT_COOL_DOWN);

server.setTestConfig(test as TestConfig);
server.setReadyToAcceptTestResults(false);

const warmupText = `Warmup for test '${test.name}' [${testIndex + 1}/${tests.length}]`;

Expand All @@ -193,6 +194,8 @@ const runTests = async (): Promise<void> => {
await runTestIteration(config.DELTA_APP_PACKAGE, `[DELTA] ${warmupText}. Iteration ${i + 1}/${iterations}`);
}

server.setReadyToAcceptTestResults(true);

// For each test case we allow the test to fail three times before we stop the test run:
const errorCountRef = {
errorCount: 0,
Expand Down
Loading