File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package remote
19
19
import (
20
20
"context"
21
21
"fmt"
22
+ "math"
22
23
"net"
23
24
"testing"
24
25
"time"
@@ -158,7 +159,8 @@ func TestClusterCacheHealthCheck(t *testing.T) {
158
159
ns := setup (t , g )
159
160
defer teardown (t , g , ns )
160
161
// Create a context with a timeout to cancel the healthcheck after some time
161
- ctx , cancel := context .WithTimeout (ctx , time .Second )
162
+ contextTimeout := time .Second
163
+ ctx , cancel := context .WithTimeout (ctx , contextTimeout )
162
164
defer cancel ()
163
165
// Delete the cluster accessor and lock the cluster to simulate creation of a new cluster accessor
164
166
cct .deleteAccessor (ctx , testClusterKey )
@@ -177,8 +179,9 @@ func TestClusterCacheHealthCheck(t *testing.T) {
177
179
path : "/" ,
178
180
})
179
181
timeElapsedForHealthCheck := time .Since (startHealthCheck )
182
+ timeElapsedForHealthCheckRounded := int (math .Round (timeElapsedForHealthCheck .Seconds ()))
180
183
// If the duration is shorter than the timeout, we know that the healthcheck wasn't requeued properly.
181
- g .Expect (timeElapsedForHealthCheck ).Should (BeNumerically (">=" , time . Second ))
184
+ g .Expect (timeElapsedForHealthCheckRounded ).Should (BeNumerically (">=" , int ( contextTimeout . Seconds ()) ))
182
185
// The healthcheck should be aborted by the timout of the context
183
186
g .Expect (ctx .Done ()).Should (BeClosed ())
184
187
})
You can’t perform that action at this time.
0 commit comments