Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 4b877a1

Browse files
author
Dongsu Park
committed
functional: sleep shortly to avoid errors in TestScheduleOneWayConflict
In TestScheduleOneWayConflict, after destroying conflicts-with-hello.service, we need to sleep shortly to avoid occasional errors of conflicts-with-hello.service being rescheduled even after being destroyed. In that case, the conflicts unit remains active, while the original hello.service remains inactive. Then the test TestScheduleOneWayConflict fails at the end with a message "Incorrect unit started". This error seems to occur frequently when enable_grpc turned on. This sleep is just a workaround. We should find out the long-term solution. Also note that, before commit 8cfc189 ("Functional tests: Fix race condition in TestScheduleOneWayConflict()"), this error didn't occur, because there was already a sleep for 5 seconds in place. However, the commit 8cfc189 tried to fix a race using util.WaitForState(), also by removing the original sleep. Actually the commit didn't completely fix the race, so the hidden bug started to reappear.
1 parent def63c9 commit 4b877a1

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

functional/scheduling_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"path/filepath"
2222
"strings"
2323
"testing"
24+
"time"
2425

2526
"github.com/coreos/fleet/functional/platform"
2627
"github.com/coreos/fleet/functional/util"
@@ -284,6 +285,15 @@ func TestScheduleOneWayConflict(t *testing.T) {
284285
t.Fatalf("Failed destroying %s", name)
285286
}
286287

288+
// NOTE: we need to sleep here shortly to avoid occasional errors of
289+
// conflicts-with-hello.service being rescheduled even after being destroyed.
290+
// In that case, the conflicts unit remains active, while the original
291+
// hello.service remains inactive. Then the test TestScheduleOneWayConflict
292+
// fails at the end with a message "Incorrect unit started".
293+
// This error seems to occur frequently when enable_grpc turned on.
294+
// - dpark 20160615
295+
time.Sleep(1 * time.Second)
296+
287297
// Wait for the destroyed unit to actually disappear
288298
timeout, err := util.WaitForState(
289299
func() bool {

0 commit comments

Comments
 (0)