fn: shutdown improvements (#1009)

*) singleton style teardown for api tests
*) cancel content for system tests
This commit is contained in:
Tolga Ceylan
2018-05-18 14:40:15 -07:00
committed by GitHub
parent 3198a14410
commit e9c465c781
2 changed files with 107 additions and 53 deletions

View File

@@ -37,11 +37,14 @@ func NewSystemTestNodePool() (pool.RunnerPool, error) {
type state struct {
memory string
cancel func()
}
func SetUpSystem() (*state, error) {
ctx := context.Background()
state := &state{}
ctx, cancel := context.WithCancel(context.Background())
state := &state{
cancel: cancel,
}
api, err := SetUpAPINode(ctx)
if err != nil {
@@ -106,6 +109,11 @@ func CleanUpSystem(st *state) error {
if err != nil {
return err
}
if st.cancel != nil {
st.cancel()
}
// Wait for shutdown - not great
time.Sleep(5 * time.Second)