2
0
Fork 0
mirror of https://code.forgejo.org/docker/build-push-action.git synced 2025-09-16 18:06:55 +00:00

test: fix platform test to work on both ARM and AMD runners

The test was hardcoded to expect arm64 platform, causing failures
on AMD runners. Now checks actual host architecture dynamically.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude 2025-06-11 13:31:15 -04:00
parent a7fa33c366
commit 616bee01ad
4 changed files with 72 additions and 6 deletions

View file

@ -28,14 +28,13 @@ describe('Remote builder platform argument resolution', () => {
});
test('falls back to host architecture when no platforms supplied', async () => {
jest.spyOn(os, 'arch').mockReturnValue('arm64' as any);
const platformStr = resolveRemoteBuilderPlatforms([]);
expect(platformStr).toBe('linux/arm64');
const expectedPlatform = os.arch() === 'arm64' ? 'linux/arm64' : 'linux/amd64';
expect(platformStr).toBe(expectedPlatform);
const args = await getRemoteBuilderArgs(builderName, builderUrl, []);
const idx = args.indexOf('--platform');
expect(idx).toBeGreaterThan(-1);
expect(args[idx + 1]).toBe('linux/arm64');
expect(args[idx + 1]).toBe(expectedPlatform);
});
});