Skip to content

Commit 98c0f36

Browse files
committed
A wider downtime window to avoid flaky test
1 parent 6137efa commit 98c0f36

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

director/director_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ func TestDirectorRegistration(t *testing.T) {
12431243
t.Run("future-to-active-toggle", func(t *testing.T) {
12441244
teardown()
12451245
c, r, w := setupContext()
1246+
now := time.Now().UTC().UnixMilli()
12461247

12471248
pKey, token, _ := generateToken()
12481249
pub, err := jwk.PublicKeyOf(pKey)
@@ -1267,7 +1268,10 @@ func TestDirectorRegistration(t *testing.T) {
12671268
// 2) now active
12681269
ad2 := baseAd
12691270
ad2.Downtimes = []server_structs.Downtime{
1270-
makeDT(now-1_000, now+1_000),
1271+
// A new active downtime with 20s (+/-10s) window to prevent it expiring
1272+
// before the server ad gets to the Director, which results in a flaky test.
1273+
// This should clear the previous future downtime.
1274+
makeDT(now-10_000, now+10_000),
12711275
}
12721276
ad2.Initialize("test-cache")
12731277
body2, _ := json.Marshal(ad2)

0 commit comments

Comments
 (0)