How to use StopAndDrain method of internal Package

Best Ginkgo code snippet using internal.StopAndDrain


Source:run_command.go Github


Full Screen

...94				break SUITE_LOOP95			}96			suites[suiteIdx] = suite97			if r.interruptHandler.Status().Interrupted {98				opc.StopAndDrain()99				break OUTER_LOOP100			}101			if suites[suiteIdx].State.Is(internal.TestSuiteStateSkippedDueToEmptyCompilation) {102				fmt.Printf("Skipping %s (no test files)\n", suite.Path)103				continue SUITE_LOOP104			}105			if suites[suiteIdx].State.Is(internal.TestSuiteStateFailedToCompile) {106				fmt.Println(suites[suiteIdx].CompilationError.Error())107				if !r.cliConfig.KeepGoing {108					opc.StopAndDrain()109				}110				continue SUITE_LOOP111			}112			if suites.CountWithState(internal.TestSuiteStateFailureStates...) > 0 && !r.cliConfig.KeepGoing {113				suites[suiteIdx].State = internal.TestSuiteStateSkippedDueToPriorFailures114				opc.StopAndDrain()115				continue SUITE_LOOP116			}117			if !endTime.IsZero() {118				r.suiteConfig.Timeout = endTime.Sub(time.Now())119				if r.suiteConfig.Timeout <= 0 {120					suites[suiteIdx].State = internal.TestSuiteStateFailedDueToTimeout121					opc.StopAndDrain()122					continue SUITE_LOOP123				}124			}125			suites[suiteIdx] = internal.RunCompiledSuite(suites[suiteIdx], r.suiteConfig, r.reporterConfig, r.cliConfig, r.goFlagsConfig, additionalArgs)126		}127		if suites.CountWithState(internal.TestSuiteStateFailureStates...) > 0 {128			if iteration > 0 {129				fmt.Printf("\nTests failed on attempt #%d\n\n", iteration+1)130			}131			break OUTER_LOOP132		}133		if r.cliConfig.UntilItFails {134			fmt.Printf("\nAll tests passed...\nWill keep running them until they fail.\nThis was attempt #%d\n%s\n", iteration+1, orcMessage(iteration+1))135		} else if r.cliConfig.Repeat > 0 && iteration < r.cliConfig.Repeat {...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Ginkgo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?