MCPcopy Index your code
hub / github.com/cloudgraphdev/cli / stopDgraphContainer

Function stopDgraphContainer

test/helpers/index.ts:261–288  ·  view source on GitHub ↗
(
  rmContainer = false
)

Source from the content-addressed store, hash-verified

259}
260
261export const stopDgraphContainer = async (
262 rmContainer = false
263): Promise<void> => {
264 try {
265 let containerToRemove: undefined | string
266 const runningContainerId = await findExistingDGraphContainerId('running')
267 if (runningContainerId) {
268 logger.debug(
269 `Stopping ${rmContainer ? 'and deleting' : ''} ${runningContainerId}`
270 )
271 await execCommand(`docker stop ${runningContainerId}`)
272 logger.debug(`${runningContainerId} stopped successfully`)
273 containerToRemove = runningContainerId
274 } else {
275 const exitedContainerId = await findExistingDGraphContainerId('exited')
276 if (exitedContainerId) {
277 containerToRemove = exitedContainerId
278 }
279 }
280 if (rmContainer && containerToRemove) {
281 await execCommand(`docker rm ${containerToRemove}`)
282 logger.debug(`${containerToRemove} removed successfully`)
283 }
284 } catch (error) {
285 logger.debug('Error while stopping dgraph container')
286 logger.debug(error)
287 }
288}
289
290export const initDgraphContainer = async (): Promise<void> => {
291 try {

Callers 4

launch.test.tsFile · 0.90
serve.test.tsFile · 0.90
teardown.test.tsFile · 0.90
initDgraphContainerFunction · 0.85

Calls 2

execCommandFunction · 0.90

Tested by

no test coverage detected