Skip to content

Commit 8d59839

Browse files
committed
test: Speed up docker-compose down
1 parent f12d058 commit 8d59839

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/commands/test.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ module.exports = {
104104
let tempdir = tmp.dirSync({ prefix: 'graph-test', unsafeCleanup: true }).name
105105
try {
106106
await configureTestEnvironment(toolbox, tempdir, composeFile, nodeImage)
107-
} catch(e) {
107+
} catch (e) {
108108
process.exitCode = 1
109109
return
110110
}
111111

112112
// Bring up test environment
113113
try {
114114
await startTestEnvironment(tempdir)
115-
} catch(e) {
115+
} catch (e) {
116116
print.error(`${e}`)
117117
process.exitCode = 1
118118
return
@@ -125,7 +125,7 @@ module.exports = {
125125
skipWaitForIpfs,
126126
skipWaitForPostgres,
127127
})
128-
} catch(e) {
128+
} catch (e) {
129129
await stopTestEnvironment(tempdir)
130130
process.exitCode = 1
131131
return
@@ -141,7 +141,7 @@ module.exports = {
141141
standaloneNodeArgs,
142142
nodeOutputChunks,
143143
)
144-
} catch(e) {
144+
} catch (e) {
145145
toolbox.print.error('')
146146
toolbox.print.error(' Graph Node')
147147
toolbox.print.error(' ----------')
@@ -158,7 +158,7 @@ module.exports = {
158158
// Wait for Graph Node to come up
159159
try {
160160
await waitForGraphNode()
161-
} catch(e) {
161+
} catch (e) {
162162
toolbox.print.error('')
163163
toolbox.print.error(' Graph Node')
164164
toolbox.print.error(' ----------')
@@ -181,7 +181,7 @@ module.exports = {
181181
if (nodeProcess) {
182182
try {
183183
await stopGraphNode(nodeProcess)
184-
} catch(e) {
184+
} catch (e) {
185185
// do nothing (the spinner already logs the problem)
186186
}
187187
}
@@ -202,7 +202,7 @@ module.exports = {
202202
// Bring down the test environment
203203
try {
204204
await stopTestEnvironment(tempdir)
205-
} catch(e) {
205+
} catch (e) {
206206
// do nothing (the spinner already logs the problem)
207207
}
208208

@@ -383,6 +383,9 @@ const stopTestEnvironment = async tempdir =>
383383
`Failed to stop test environment`,
384384
`Warnings stopping test environment`,
385385
async spinner => {
386+
// Our containers do not respond quickly to the SIGTERM which `down` tries before timing out
387+
// and killing them, so speed things up by sending a SIGKILL right away.
388+
await compose.kill({ cwd: path.join(tempdir, 'compose') })
386389
await compose.down({ cwd: path.join(tempdir, 'compose') })
387390
},
388391
)

0 commit comments

Comments
 (0)