Skip to content

Commit d6b8e14

Browse files
committed
test
1 parent c3e6670 commit d6b8e14

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

.github/workflows/dev-containers.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ jobs:
5252
"src/test/cli.exec.buildKit.2.test.ts",
5353
"src/test/cli.exec.nonBuildKit.1.test.ts",
5454
"src/test/cli.exec.nonBuildKit.2.test.ts",
55+
"src/test/cli.podman.test.ts",
5556
"src/test/cli.test.ts",
5657
"src/test/cli.up.test.ts",
5758
"src/test/imageMetadata.test.ts",
5859
"src/test/container-features/containerFeaturesOCIPush.test.ts",
5960
# Run all except the above:
60-
"--exclude src/test/container-features/containerFeaturesOrder.test.ts --exclude src/test/container-features/registryCompatibilityOCI.test.ts --exclude src/test/container-features/containerFeaturesOCIPush.test.ts --exclude src/test/container-features/e2e.test.ts --exclude src/test/container-features/featuresCLICommands.test.ts --exclude src/test/cli.build.test.ts --exclude src/test/cli.exec.buildKit.1.test.ts --exclude src/test/cli.exec.buildKit.2.test.ts --exclude src/test/cli.exec.nonBuildKit.1.test.ts --exclude src/test/cli.exec.nonBuildKit.2.test.ts --exclude src/test/cli.test.ts --exclude src/test/cli.up.test.ts --exclude src/test/imageMetadata.test.ts 'src/test/**/*.test.ts'",
61+
"--exclude src/test/container-features/containerFeaturesOrder.test.ts --exclude src/test/container-features/registryCompatibilityOCI.test.ts --exclude src/test/container-features/containerFeaturesOCIPush.test.ts --exclude src/test/container-features/e2e.test.ts --exclude src/test/container-features/featuresCLICommands.test.ts --exclude src/test/cli.build.test.ts --exclude src/test/cli.exec.buildKit.1.test.ts --exclude src/test/cli.exec.buildKit.2.test.ts --exclude src/test/cli.exec.nonBuildKit.1.test.ts --exclude src/test/cli.exec.nonBuildKit.2.test.ts --exclude src/test/cli.podman.test.ts --exclude src/test/cli.test.ts --exclude src/test/cli.up.test.ts --exclude src/test/imageMetadata.test.ts 'src/test/**/*.test.ts'",
6162
]
6263
steps:
6364
- name: Checkout

src/test/cli.podman.test.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import * as assert from 'assert';
7+
import * as path from 'path';
8+
import { shellExec } from './testUtils';
9+
10+
const pkg = require('../../package.json');
11+
12+
describe('Dev Containers CLI using Podman', function () {
13+
this.timeout('240s');
14+
15+
const tmp = path.relative(process.cwd(), path.join(__dirname, 'tmp'));
16+
const cli = `npx --prefix ${tmp} devcontainer`;
17+
18+
before('Install', async () => {
19+
await shellExec(`rm -rf ${tmp}/node_modules`);
20+
await shellExec(`mkdir -p ${tmp}`);
21+
await shellExec(`npm --prefix ${tmp} install devcontainers-cli-${pkg.version}.tgz`);
22+
});
23+
24+
describe('Command up using Podman', () => {
25+
26+
it('should execute successfully with valid config with features', async () => {
27+
const res = await shellExec(`${cli} up --docker-path podman --workspace-folder ${__dirname}/configs/image-with-features`);
28+
const response = JSON.parse(res.stdout);
29+
assert.equal(response.outcome, 'success');
30+
const containerId: string = response.containerId;
31+
assert.ok(containerId, 'Container id not found.');
32+
await shellExec(`podman rm -f ${containerId}`);
33+
});
34+
35+
it('should execute successfully with valid config with features', async () => {
36+
const res = await shellExec(`${cli} up --docker-path podman --workspace-folder ${__dirname}/configs/dockerfile-with-features`);
37+
const response = JSON.parse(res.stdout);
38+
assert.equal(response.outcome, 'success');
39+
const containerId: string = response.containerId;
40+
assert.ok(containerId, 'Container id not found.');
41+
await shellExec(`podman rm -f ${containerId}`);
42+
});
43+
});
44+
});

0 commit comments

Comments
 (0)