-
Notifications
You must be signed in to change notification settings - Fork 15
test: add --skip-pull integration test #1222
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| /** | ||
| * Skip Pull Flag Tests | ||
| * | ||
| * These tests verify the --skip-pull flag behavior: | ||
| * - Success when images are pre-downloaded (uses --build-local first to ensure images exist) | ||
| * - Error when images are not available locally | ||
| * - Rejection of --skip-pull with --build-local (incompatible flags) | ||
| */ | ||
|
|
||
| /// <reference path="../jest-custom-matchers.d.ts" /> | ||
|
|
||
| import { describe, test, expect, beforeAll, afterAll } from '@jest/globals'; | ||
| import { createRunner, AwfRunner } from '../fixtures/awf-runner'; | ||
| import { cleanup } from '../fixtures/cleanup'; | ||
|
|
||
| describe('Skip Pull Flag', () => { | ||
| let runner: AwfRunner; | ||
|
|
||
| beforeAll(async () => { | ||
| await cleanup(false); | ||
| runner = createRunner(); | ||
| }); | ||
|
|
||
| afterAll(async () => { | ||
| await cleanup(false); | ||
| }); | ||
|
|
||
| test('should succeed with --skip-pull when images are pre-downloaded', async () => { | ||
| // First, ensure images exist locally by building them | ||
| const buildResult = await runner.runWithSudo( | ||
| 'echo "images built"', | ||
| { | ||
| allowDomains: ['github.com'], | ||
| buildLocal: true, | ||
| logLevel: 'debug', | ||
| timeout: 120000, | ||
| } | ||
| ); | ||
| expect(buildResult).toSucceed(); | ||
|
|
||
| // Now run with --skip-pull, which should use the locally available images | ||
| const result = await runner.runWithSudo( | ||
| 'echo "skip-pull works"', | ||
| { | ||
| allowDomains: ['github.com'], | ||
| skipPull: true, | ||
| logLevel: 'debug', | ||
| timeout: 60000, | ||
| } | ||
| ); | ||
|
|
||
| expect(result).toSucceed(); | ||
| expect(result.stdout).toContain('skip-pull works'); | ||
| }, 240000); | ||
|
|
||
| test('should fail with --skip-pull when images are not available locally', async () => { | ||
| // Use a non-existent image tag so Docker cannot find it locally | ||
| const result = await runner.runWithSudo( | ||
| 'echo "should not reach here"', | ||
| { | ||
| allowDomains: ['github.com'], | ||
| skipPull: true, | ||
| imageTag: 'nonexistent-tag-xyz-999', | ||
| logLevel: 'debug', | ||
| timeout: 60000, | ||
| } | ||
| ); | ||
|
|
||
| expect(result).toFail(); | ||
| }, 120000); | ||
|
|
||
| test('should reject --skip-pull with --build-local', async () => { | ||
| const result = await runner.runWithSudo( | ||
| 'echo "should not reach here"', | ||
| { | ||
| allowDomains: ['github.com'], | ||
| skipPull: true, | ||
| buildLocal: true, | ||
| logLevel: 'debug', | ||
| timeout: 30000, | ||
| } | ||
| ); | ||
|
|
||
| expect(result).toFail(); | ||
| expect(result.stderr).toContain('--skip-pull cannot be used with --build-local'); | ||
| }, 60000); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The “pre-download” step uses
buildLocal: true, but--build-localbuilds Compose services without animage:name (Compose auto-names them), while the subsequent--skip-pullrun uses GHCRimage: ${registry}/…:${tag}. This means the first run does not actually populate the local cache for the images that--skip-pullwill try to start, so this test can fail even though the intent is to validate cached-pull behavior.To make this deterministic, prime the cache by running once with the same GHCR image settings (i.e., without
--skip-pulland without--build-local) or explicitlydocker pullthe expected${registry}/{squid,agent,api-proxy}:<tag>images before running with--skip-pull.