Skip to content

Commit 7ac7c19

Browse files
authored
Stabilize test-coverage-reporter by isolating main-action unit tests from DinD probing (#3595)
* Initial plan * test: mock dind probe in main-action unit tests --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent d5ba0de commit 7ac7c19

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/commands/main-action.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jest.mock('../host-iptables');
77
jest.mock('../cli-workflow');
88
jest.mock('../redact-secrets');
99
jest.mock('../option-parsers');
10+
jest.mock('../dind-probe');
1011
jest.mock('./preflight');
1112
jest.mock('./signal-handler');
1213
jest.mock('./validate-options');
@@ -17,6 +18,7 @@ import * as hostIptables from '../host-iptables';
1718
import * as cliWorkflow from '../cli-workflow';
1819
import * as redactSecrets from '../redact-secrets';
1920
import * as optionParsers from '../option-parsers';
21+
import * as dindProbe from '../dind-probe';
2022
import * as preflight from './preflight';
2123
import * as signalHandler from './signal-handler';
2224
import * as validateOptions from './validate-options';
@@ -27,6 +29,7 @@ const mockedHostIptables = hostIptables as jest.Mocked<typeof hostIptables>;
2729
const mockedCliWorkflow = cliWorkflow as jest.Mocked<typeof cliWorkflow>;
2830
const mockedRedactSecrets = redactSecrets as jest.Mocked<typeof redactSecrets>;
2931
const mockedOptionParsers = optionParsers as jest.Mocked<typeof optionParsers>;
32+
const mockedDindProbe = dindProbe as jest.Mocked<typeof dindProbe>;
3033
const mockedPreflight = preflight as jest.Mocked<typeof preflight>;
3134
const mockedSignalHandler = signalHandler as jest.Mocked<typeof signalHandler>;
3235
const mockedValidateOptions = validateOptions as jest.Mocked<typeof validateOptions>;
@@ -71,6 +74,11 @@ describe('createMainAction', () => {
7174
mockedDockerManager.setAwfDockerHost.mockImplementation(() => {});
7275
mockedRedactSecrets.redactSecrets.mockImplementation((s: string) => s);
7376
mockedOptionParsers.joinShellArgs.mockImplementation((args: string[]) => args.join(' '));
77+
mockedDindProbe.probeSplitFilesystem.mockResolvedValue({
78+
prefix: undefined,
79+
splitDetected: false,
80+
inconclusive: false,
81+
});
7482
mockedSignalHandler.registerSignalHandlers.mockImplementation(() => {});
7583
mockedCliWorkflow.runMainWorkflow.mockResolvedValue(0);
7684
});

0 commit comments

Comments
 (0)