Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,34 @@
* Starter corpus. Expand per resolveDepgraphs-rollout-plan.md.
*/

import { fakeServer } from '../../../acceptance/fake-server';
import {
fakeServer,
getFirstIPv4Address,
} from '../../../acceptance/fake-server';
import { createProjectFromWorkspace } from '../../util/createProject';
import { getServerPort } from '../../util/getServerPort';
import { getAvailableServerPort } from '../../util/getServerPort';
import { assertEquivalent, runBothFlows } from './equivalenceHelpers';

jest.setTimeout(1000 * 60 * 3);
jest.setTimeout(1000 * 60 * 5);

describe('snyk test — unified test API equivalence (FF off vs on)', () => {
let server;
let env: Record<string, string>;

beforeAll((done) => {
const port = getServerPort(process);
beforeAll(async () => {
const port = await getAvailableServerPort(process);
const baseApi = '/v1';
const fakeServerIp = getFirstIPv4Address();
env = {
...process.env,
SNYK_API: 'http://localhost:' + port + baseApi,
SNYK_HOST: 'http://localhost:' + port,
SNYK_API: `http://${fakeServerIp}:${port}${baseApi}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question: Is there any explanation why this change has an effect on flakiness?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In general it is the right move to use this pattern but for other reasons then flakiness in my understanding.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it seems he's applying the pattern in other tests, so sounds correct.
For the flakiness, it might be the timeout increase to fix it:
Image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was writing a comment here, it turned to be the same as this

For the flakiness, it might be the timeout increase to fix it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes, I added the timeout ;)

SNYK_HOST: `http://${fakeServerIp}:${port}`,
SNYK_TOKEN: '123456789',
SNYK_DISABLE_ANALYTICS: '1',
SNYK_HTTP_PROTOCOL_UPGRADE: '0',
};
server = fakeServer(baseApi, env.SNYK_TOKEN);
server.listen(port, () => done());
await server.listenPromise(port);
});

afterAll((done) => {
Expand Down