-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.test.ts
More file actions
60 lines (49 loc) · 1.18 KB
/
basic.test.ts
File metadata and controls
60 lines (49 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { DockerClient } from "../lib";
import { collect } from "./utils";
test("plain", async () => {
const client = await DockerClient({
baseURL: new URL("unix:/var/run/docker.sock"),
});
const systemInfo = await client.System.Info();
expect(systemInfo.ID).toHaveLength(36);
const pullResp = await client.Image.Create({
query: {
fromImage: "hello-world",
tag: "latest",
},
});
const pullLogs = await collect(pullResp);
expect(pullLogs.length).toBeGreaterThan(0);
const createResp = await client.Container.Create({
body: {
Image: "hello-world",
},
});
await client.Container.Start({
path: {
id: createResp.Id,
},
});
const waitResp = await client.Container.Wait({
path: {
id: createResp.Id,
},
});
expect(waitResp.StatusCode).toBe(0);
const containerLogsResp = await client.Container.Logs({
path: {
id: createResp.Id,
},
query: {
stdout: true,
stderr: true,
},
});
const containerLogs = await collect(containerLogsResp);
expect(containerLogs.length).toBeGreaterThan(0);
await client.Container.Delete({
path: {
id: createResp.Id,
},
});
});