mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-23 03:16:09 +08:00
ci: split docker install integration tests
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
c2a62c4476
commit
750472e8ac
23
.github/workflows/test.yml
vendored
23
.github/workflows/test.yml
vendored
@ -99,6 +99,27 @@ jobs:
|
|||||||
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
- macos-13
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
|
includes:
|
||||||
|
- os: macos-13
|
||||||
|
test: docker/install.test.itg.ts
|
||||||
|
docker_install_type: image
|
||||||
|
docker_install_version: 27.3.1
|
||||||
|
- os: macos-13
|
||||||
|
test: docker/install.test.itg.ts
|
||||||
|
docker_install_type: image
|
||||||
|
docker_install_version: master
|
||||||
|
- os: macos-13
|
||||||
|
test: docker/install.test.itg.ts
|
||||||
|
docker_install_type: image
|
||||||
|
docker_install_version: latest
|
||||||
|
- os: macos-13
|
||||||
|
test: docker/install.test.itg.ts
|
||||||
|
docker_install_type: archive
|
||||||
|
docker_install_version: v26.1.4
|
||||||
|
- os: macos-13
|
||||||
|
test: docker/install.test.itg.ts
|
||||||
|
docker_install_type: archive
|
||||||
|
docker_install_version: latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
@ -151,6 +172,8 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
CTN_BUILDER_NAME: ${{ steps.builder.outputs.name }}
|
CTN_BUILDER_NAME: ${{ steps.builder.outputs.name }}
|
||||||
TEST_FOR_SUMMARY: ${{ secrets.TEST_FOR_SUMMARY }}
|
TEST_FOR_SUMMARY: ${{ secrets.TEST_FOR_SUMMARY }}
|
||||||
|
DOCKER_INSTALL_TYPE: ${{ matrix.docker_install_type }}
|
||||||
|
DOCKER_INSTALL_VERSION: ${{ matrix.docker_install_version }}
|
||||||
-
|
-
|
||||||
name: Check coverage
|
name: Check coverage
|
||||||
run: |
|
run: |
|
||||||
|
@ -14,18 +14,21 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {jest, describe, test, beforeEach, afterEach, expect} from '@jest/globals';
|
import {jest, describe, beforeEach, afterEach, expect, it} from '@jest/globals';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import {Install, InstallSourceArchive, InstallSourceImage} from '../../src/docker/install';
|
import {Install, InstallSource, InstallSourceArchive, InstallSourceImage} from '../../src/docker/install';
|
||||||
import {Docker} from '../../src/docker/docker';
|
import {Docker} from '../../src/docker/docker';
|
||||||
import {Exec} from '../../src/exec';
|
import {Exec} from '../../src/exec';
|
||||||
|
|
||||||
|
const dockerInstallType = process.env.DOCKER_INSTALL_TYPE || 'archive';
|
||||||
|
const dockerInstallVersion = process.env.DOCKER_INSTALL_VERSION || 'latest';
|
||||||
|
|
||||||
const tmpDir = () => fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'docker-install-itg-'));
|
const tmpDir = () => fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'docker-install-itg-'));
|
||||||
|
|
||||||
describe('install', () => {
|
describe('root', () => {
|
||||||
const originalEnv = process.env;
|
const originalEnv = process.env;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
@ -39,41 +42,26 @@ aarch64:https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-g
|
|||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
process.env = originalEnv;
|
process.env = originalEnv;
|
||||||
});
|
});
|
||||||
// prettier-ignore
|
it(
|
||||||
test.each([
|
'install docker',
|
||||||
{type: 'image', tag: '27.3.1'} as InstallSourceImage,
|
async () => {
|
||||||
{type: 'image', tag: 'master'} as InstallSourceImage,
|
|
||||||
{type: 'image', tag: 'latest'} as InstallSourceImage,
|
|
||||||
{type: 'archive', version: 'v26.1.4', channel: 'stable'} as InstallSourceArchive,
|
|
||||||
{type: 'archive', version: 'latest', channel: 'stable'} as InstallSourceArchive,
|
|
||||||
])(
|
|
||||||
'install docker %s', async (source) => {
|
|
||||||
await ensureNoSystemContainerd();
|
await ensureNoSystemContainerd();
|
||||||
const install = new Install({
|
const install = new Install({
|
||||||
source: source,
|
source: getSource(),
|
||||||
runDir: tmpDir(),
|
runDir: tmpDir(),
|
||||||
contextName: 'foo',
|
contextName: 'foo',
|
||||||
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`
|
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`
|
||||||
});
|
});
|
||||||
await expect(tryInstall(install)).resolves.not.toThrow();
|
await expect(tryInstall(install)).resolves.not.toThrow();
|
||||||
}, 30 * 60 * 1000);
|
},
|
||||||
});
|
30 * 60 * 1000
|
||||||
|
);
|
||||||
describe('rootless', () => {
|
it(
|
||||||
// prettier-ignore
|
'install rootless docker',
|
||||||
test.each([
|
async () => {
|
||||||
{type: 'image', tag: 'latest'} as InstallSourceImage,
|
|
||||||
{type: 'archive', version: 'latest', channel: 'stable'} as InstallSourceArchive,
|
|
||||||
])(
|
|
||||||
'install %s', async (source) => {
|
|
||||||
// Skip on non linux
|
|
||||||
if (os.platform() !== 'linux') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await ensureNoSystemContainerd();
|
await ensureNoSystemContainerd();
|
||||||
const install = new Install({
|
const install = new Install({
|
||||||
source: source,
|
source: getSource(),
|
||||||
runDir: tmpDir(),
|
runDir: tmpDir(),
|
||||||
contextName: 'foo',
|
contextName: 'foo',
|
||||||
daemonConfig: `{"debug":true}`,
|
daemonConfig: `{"debug":true}`,
|
||||||
@ -122,3 +110,17 @@ async function ensureNoSystemContainerd() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSource(): InstallSource {
|
||||||
|
if (dockerInstallType === 'archive') {
|
||||||
|
return {
|
||||||
|
version: dockerInstallVersion,
|
||||||
|
channel: 'stable'
|
||||||
|
} as InstallSourceArchive;
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
type: dockerInstallType,
|
||||||
|
tag: dockerInstallVersion
|
||||||
|
} as InstallSourceImage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user