-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdocker.test.ts
More file actions
38 lines (33 loc) · 1.13 KB
/
docker.test.ts
File metadata and controls
38 lines (33 loc) · 1.13 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
import {
startChainContainer,
getContainers,
killExistingChainContainer,
getChainIp,
checkContainerHealthStatus,
} from "../src/dockerClient";
import { sleep } from "../src/utils";
describe("docker client test", () => {
let port = 12345;
it("start chain container", async () => {
await startChainContainer(port);
const containers = getContainers();
const qTestContainer = containers.find((c) => c.name === "qtest12345");
// @ts-ignore
expect(qTestContainer.name).toBe("qtest12345");
expect(await checkContainerHealthStatus(port)).toBe(false);
await sleep(4000);
expect(await checkContainerHealthStatus(port)).toBe(true);
}, 20000);
it("get chain ip", async () => {
const ip = await getChainIp(port);
const ipFragment = ip.split(".");
expect(ipFragment.length).toBe(4);
expect(isNaN(Number(ipFragment[0]))).toBe(false);
});
it("kill chain container", async () => {
await killExistingChainContainer(port);
const containers = getContainers();
const qTestContainer = containers.find((c) => c.name === "qtest12345");
expect(qTestContainer).toBe(undefined);
});
});