Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable end-to-end docker tests (#185)
* Enable e2e docker tests * Make e2e test more reliable
- Loading branch information
1 parent
07d1e4f
commit 0efb825
Showing
8 changed files
with
129 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package util | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"os/signal" | ||
"syscall" | ||
) | ||
|
||
func RunCommand(cmd *exec.Cmd) error { | ||
if cmd == nil { | ||
return nil | ||
} | ||
|
||
cmdErr := make(chan error, 1) | ||
cmdStopped := make(chan bool, 1) | ||
sigCh := make(chan os.Signal, 1) | ||
signal.Notify(sigCh, syscall.SIGTERM, os.Interrupt) | ||
|
||
err := cmd.Start() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
go func() { | ||
appErr := cmd.Wait() | ||
|
||
if appErr != nil { | ||
cmdErr <- appErr | ||
} | ||
cmdStopped <- true | ||
sigCh <- os.Interrupt | ||
}() | ||
|
||
<-sigCh | ||
|
||
if cmd.ProcessState == nil || !cmd.ProcessState.Exited() { | ||
err := cmd.Process.Signal(os.Interrupt) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
<-cmdStopped | ||
|
||
if len(cmdErr) > 0 { | ||
return <-cmdErr | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters