|
1 | 1 | import { Client } from "pg"; |
2 | 2 | import { PostgreSqlContainer } from "./postgresql-container"; |
3 | 3 |
|
| 4 | +const IMAGE = "postgres:13.3-alpine"; |
| 5 | + |
4 | 6 | describe("PostgreSqlContainer snapshot and restore", { timeout: 180_000 }, () => { |
5 | 7 | // createAndRestoreFromSnapshot { |
6 | 8 | it("should create and restore from snapshot", async () => { |
7 | | - const container = await new PostgreSqlContainer().start(); |
| 9 | + const container = await new PostgreSqlContainer(IMAGE).start(); |
8 | 10 |
|
9 | 11 | // Connect to the database |
10 | 12 | let client = new Client({ |
@@ -60,7 +62,7 @@ describe("PostgreSqlContainer snapshot and restore", { timeout: 180_000 }, () => |
60 | 62 | // } |
61 | 63 |
|
62 | 64 | it("should use custom snapshot name", async () => { |
63 | | - const container = await new PostgreSqlContainer().start(); |
| 65 | + const container = await new PostgreSqlContainer(IMAGE).start(); |
64 | 66 | const customSnapshotName = "my_custom_snapshot"; |
65 | 67 |
|
66 | 68 | // Connect to the database |
@@ -110,7 +112,7 @@ describe("PostgreSqlContainer snapshot and restore", { timeout: 180_000 }, () => |
110 | 112 | }); |
111 | 113 |
|
112 | 114 | it("should handle multiple snapshots", async () => { |
113 | | - const container = await new PostgreSqlContainer().start(); |
| 115 | + const container = await new PostgreSqlContainer(IMAGE).start(); |
114 | 116 |
|
115 | 117 | // Connect to the database |
116 | 118 | let client = new Client({ |
@@ -193,7 +195,7 @@ describe("PostgreSqlContainer snapshot and restore", { timeout: 180_000 }, () => |
193 | 195 | }); |
194 | 196 |
|
195 | 197 | it("should throw an error when trying to snapshot postgres system database", async () => { |
196 | | - const container = await new PostgreSqlContainer().withDatabase("postgres").start(); |
| 198 | + const container = await new PostgreSqlContainer(IMAGE).withDatabase("postgres").start(); |
197 | 199 |
|
198 | 200 | await expect(container.snapshot()).rejects.toThrow( |
199 | 201 | "Snapshot feature is not supported when using the postgres system database" |
|
0 commit comments