mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 08:50:42 +02:00
testenv: add Pause() method (#5367)
This commit is contained in:
parent
37017e2a5b
commit
135e737d7c
1 changed files with 12 additions and 0 deletions
|
@ -114,6 +114,10 @@ type Environment interface {
|
|||
// no effect. It is usually not necessary to call Stop() directly unless you
|
||||
// need to stop the test environment before the test is completed.
|
||||
Stop()
|
||||
// Pause will block and wait until SIGINT is received, then continue. This
|
||||
// has the same effect as if the test failed and the PauseOnFailure option was
|
||||
// given, but can be called at any time.
|
||||
Pause()
|
||||
|
||||
// SubdomainURL returns a string [values.Value] which will contain a complete
|
||||
// URL for the given subdomain of the server's domain (given by its serving
|
||||
|
@ -642,6 +646,14 @@ func (e *environment) Stop() {
|
|||
})
|
||||
}
|
||||
|
||||
func (e *environment) Pause() {
|
||||
e.t.Log("\x1b[31m*** test manually paused; continue with ctrl+c ***\x1b[0m")
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGINT)
|
||||
<-c
|
||||
e.t.Log("\x1b[31mctrl+c received, continuing\x1b[0m")
|
||||
}
|
||||
|
||||
func (e *environment) cleanup() {
|
||||
e.cleanupOnce.Do(func() {
|
||||
e.debugf("stop: test cleanup")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue