@flakiness/shared
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -5,4 +5,3 @@ class ManualPromise { | ||
_reject; | ||
_timeoutId; | ||
constructor(timeoutMs) { | ||
constructor() { | ||
this.promise = new Promise((resolve, reject) => { | ||
@@ -12,17 +11,9 @@ this._resolve = resolve; | ||
}); | ||
this._timeoutId = setTimeout(() => { | ||
this.reject(new Error(`Timeout ${timeoutMs}ms exceeded`)); | ||
}, timeoutMs); | ||
} | ||
resolve(e) { | ||
this._resolve(e); | ||
this.dispose(); | ||
} | ||
reject(e) { | ||
this._reject(e); | ||
this.dispose(); | ||
} | ||
dispose() { | ||
clearTimeout(this._timeoutId); | ||
} | ||
} | ||
@@ -29,0 +20,0 @@ export { |
@@ -12,3 +12,3 @@ import ms from "ms"; | ||
} | ||
static async launch({ db = "mydatabase", rootPassword = "rootpassword" } = {}) { | ||
static async launch({ db = "mydatabase", rootPassword = "rootpassword", label = MYSQL_CONTAINER_LABEL } = {}) { | ||
const images = await dockerApi.listImages(); | ||
@@ -25,4 +25,4 @@ const mysqlImage = images.find((image) => image.names.includes(MYSQL_IMAGE_NAME)); | ||
healthcheck: { | ||
test: ["CMD-SHELL", `mysql --user=root --password=${rootPassword} --execute "SHOW DATABASES;"`], | ||
intervalMs: ms("1s"), | ||
test: ["CMD-SHELL", `mysqladmin ping --host 127.0.0.1 -u root --password=${rootPassword}`], | ||
intervalMs: ms("100ms"), | ||
retries: 10, | ||
@@ -32,8 +32,10 @@ startPeriodMs: 0, | ||
}, | ||
command: ["mysqld", "--innodb-force-recovery=0", "--skip-innodb-doublewrite"], | ||
labels: { | ||
[MYSQL_CONTAINER_LABEL]: "1" | ||
[label]: "1" | ||
}, | ||
env: { | ||
"MYSQL_ROOT_PASSWORD": rootPassword, | ||
"MYSQL_DATABASE": db | ||
"MYSQL_DATABASE": db, | ||
"MYSQL_INITDB_SKIP_TZINFO": true | ||
} | ||
@@ -40,0 +42,0 @@ }); |
@@ -13,3 +13,3 @@ import ms from "ms"; | ||
} | ||
static async launch({ user = "user", password = "password", db = "postgres" } = {}) { | ||
static async launch({ user = "user", password = "password", db = "postgres", label = PG_CONTAINER_LABEL } = {}) { | ||
const images = await dockerApi.listImages(); | ||
@@ -33,3 +33,3 @@ const pgImage = images.find((image) => image.names.includes(PG_IMAGE_NAME)); | ||
labels: { | ||
[PG_CONTAINER_LABEL]: "1" | ||
[label]: "1" | ||
}, | ||
@@ -36,0 +36,0 @@ env: { |
{ | ||
"name": "@flakiness/shared", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51744
12
630