MCPcopy
hub / github.com/dgraph-io/dgraph / Cleanup

Method Cleanup

dgraphtest/local_cluster.go:415–455  ·  view source on GitHub ↗
(verbose bool)

Source from the content-addressed store, hash-verified

413}
414
415func (c *LocalCluster) Cleanup(verbose bool) {
416 if c == nil {
417 return
418 }
419
420 if verbose {
421 if err := c.printAllLogs(); err != nil {
422 log.Printf("[WARNING] error printing container logs: %v", err)
423 }
424 if err := c.printInspectContainers(); err != nil {
425 log.Printf("[WARNING] error printing inspect container output: %v", err)
426 }
427 if err := c.printPortMappings(); err != nil {
428 log.Printf("[WARNING] error printing port mappings: %v", err)
429 }
430 }
431
432 log.Printf("[INFO] cleaning up cluster with prefix [%v]", c.conf.prefix)
433 if err := c.destroyContainers(); err != nil {
434 log.Printf("[WARNING] error removing container: %v", err)
435 }
436
437 ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
438 defer cancel()
439 for _, vol := range c.conf.volumes {
440 if err := c.dcli.VolumeRemove(ctx, vol, true); err != nil {
441 log.Printf("[WARNING] error removing volume [%v]: %v", vol, err)
442 }
443 }
444 if c.net.id != "" {
445 if err := c.dcli.NetworkRemove(ctx, c.net.id); err != nil {
446 log.Printf("[WARNING] error removing network [%v]: %v", c.net.name, err)
447 }
448 }
449 if err := os.RemoveAll(c.tempBinDir); err != nil {
450 log.Printf("[WARNING] error while removing temp bin dir: %v", err)
451 }
452 if err := os.RemoveAll(c.tempSecretsDir); err != nil {
453 log.Printf("[WARNING] error while removing temp secrets dir: %v", err)
454 }
455}
456
457func (c *LocalCluster) cleanupDocker() error {
458 ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)

Callers 15

TestCheckUpgradeFunction · 0.95
TestQueryDuplicateNodesFunction · 0.95
TestMCPSSEFunction · 0.95
TestMainFunction · 0.95
TestShortestPathFunction · 0.95
SetupSubTestMethod · 0.95
TestBulkLoadVectorIndexFunction · 0.95

Calls 5

printAllLogsMethod · 0.95
printPortMappingsMethod · 0.95
destroyContainersMethod · 0.95
RemoveAllMethod · 0.80

Tested by 15

TestCheckUpgradeFunction · 0.76
TestQueryDuplicateNodesFunction · 0.76
TestMCPSSEFunction · 0.76
TestMainFunction · 0.76
TestShortestPathFunction · 0.76
SetupSubTestMethod · 0.76
TestBulkLoadVectorIndexFunction · 0.76