@@ -820,19 +820,19 @@ func TestEntraidTokenManager_Streaming(t *testing.T) {
820
820
821
821
toRenewal := tm .durationToRenewal (tm .token )
822
822
assert .NotEqual (t , time .Duration (0 ), toRenewal )
823
- <- time .After (time .Millisecond )
823
+ time .Sleep (time .Millisecond )
824
824
toRenewal = tm .durationToRenewal (tm .token )
825
825
assert .NotEqual (t , expiresIn , toRenewal )
826
826
assert .True (t , expiresIn > toRenewal )
827
- <- time .After (toRenewal / 10 )
827
+ time .Sleep (toRenewal / 10 )
828
828
assert .NotNil (t , tm .listener )
829
829
assert .NoError (t , stopper ())
830
830
assert .Nil (t , tm .listener )
831
831
assert .Panics (t , func () {
832
832
close (tm .closedChan )
833
833
})
834
834
835
- <- time .After (toRenewal )
835
+ time .Sleep (toRenewal )
836
836
// already stopped
837
837
assert .Error (t , stopper ())
838
838
mock .AssertExpectationsForObjects (t , idp , mParser , listener )
@@ -894,7 +894,7 @@ func TestEntraidTokenManager_Streaming(t *testing.T) {
894
894
// wait for request token to be called
895
895
<- done
896
896
// wait a bit for listener to be notified
897
- <- time .After (10 * time .Millisecond )
897
+ time .Sleep (10 * time .Millisecond )
898
898
assert .NoError (t , cancel ())
899
899
900
900
assert .InDelta (t , stop .Sub (start ), tm .retryOptions .InitialDelay , float64 (200 * time .Millisecond ))
@@ -946,7 +946,7 @@ func TestEntraidTokenManager_Streaming(t *testing.T) {
946
946
assert .Equal (t , time .Duration (0 ), toRenewal )
947
947
assert .True (t , expiresIn > toRenewal )
948
948
949
- <- time .After ( time . Duration ( tm .retryOptions .InitialDelay / 2 ) )
949
+ time .Sleep ( tm .retryOptions .InitialDelay / 2 )
950
950
assert .NoError (t , cancel ())
951
951
assert .Nil (t , tm .listener )
952
952
assert .Panics (t , func () {
@@ -997,12 +997,12 @@ func TestEntraidTokenManager_Streaming(t *testing.T) {
997
997
998
998
toRenewal := tm .durationToRenewal (tm .token )
999
999
assert .NotEqual (t , time .Duration (0 ), toRenewal )
1000
- <- time .After (time .Millisecond )
1000
+ time .Sleep (time .Millisecond )
1001
1001
toRenewal = tm .durationToRenewal (tm .token )
1002
1002
assert .NotEqual (t , expiresIn , toRenewal )
1003
1003
assert .True (t , expiresIn > toRenewal )
1004
1004
1005
- <- time .After (toRenewal + time .Second )
1005
+ time .Sleep (toRenewal + time .Second )
1006
1006
1007
1007
mock .AssertExpectationsForObjects (t , idp , listener )
1008
1008
})
@@ -1052,11 +1052,11 @@ func TestEntraidTokenManager_Streaming(t *testing.T) {
1052
1052
1053
1053
toRenewal := tm .durationToRenewal (tm .token )
1054
1054
assert .NotEqual (t , time .Duration (0 ), toRenewal )
1055
- <- time .After (time .Millisecond )
1055
+ time .Sleep (time .Millisecond )
1056
1056
toRenewal = tm .durationToRenewal (tm .token )
1057
1057
assert .NotEqual (t , expiresIn , toRenewal )
1058
1058
assert .True (t , expiresIn > toRenewal )
1059
- <- time .After (toRenewal + 100 * time .Millisecond )
1059
+ time .Sleep (toRenewal + 100 * time .Millisecond )
1060
1060
idp .AssertNumberOfCalls (t , "RequestToken" , 2 )
1061
1061
mock .AssertExpectationsForObjects (t , idp , listener )
1062
1062
})
@@ -1106,11 +1106,11 @@ func TestEntraidTokenManager_Streaming(t *testing.T) {
1106
1106
1107
1107
toRenewal := tm .durationToRenewal (tm .token )
1108
1108
assert .NotEqual (t , time .Duration (0 ), toRenewal )
1109
- <- time .After (time .Millisecond )
1109
+ time .Sleep (time .Millisecond )
1110
1110
toRenewal = tm .durationToRenewal (tm .token )
1111
1111
assert .NotEqual (t , expiresIn , toRenewal )
1112
1112
assert .True (t , expiresIn > toRenewal )
1113
- <- time .After (toRenewal + 100 * time .Millisecond )
1113
+ time .Sleep (toRenewal + 100 * time .Millisecond )
1114
1114
1115
1115
idp .AssertNumberOfCalls (t , "RequestToken" , 2 )
1116
1116
listener .AssertNumberOfCalls (t , "OnError" , 1 )
@@ -1181,7 +1181,7 @@ func TestEntraidTokenManager_Streaming(t *testing.T) {
1181
1181
assert .NotNil (t , tm .listener )
1182
1182
toRenewal := tm .durationToRenewal (tm .token )
1183
1183
assert .NotEqual (t , time .Duration (0 ), toRenewal )
1184
- <- time .After (time .Millisecond )
1184
+ time .Sleep (time .Millisecond )
1185
1185
toRenewal = tm .durationToRenewal (tm .token )
1186
1186
assert .NotEqual (t , expiresIn , toRenewal )
1187
1187
assert .True (t , expiresIn > toRenewal )
@@ -1260,12 +1260,12 @@ func TestEntraidTokenManager_Streaming(t *testing.T) {
1260
1260
toRenewal := tm .durationToRenewal (tm .token )
1261
1261
assert .NotEqual (t , time .Duration (0 ), toRenewal )
1262
1262
1263
- <- time .After (time .Millisecond )
1263
+ time .Sleep (time .Millisecond )
1264
1264
toRenewal = tm .durationToRenewal (tm .token )
1265
1265
assert .NotEqual (t , expiresIn , toRenewal )
1266
1266
assert .True (t , expiresIn > toRenewal )
1267
1267
1268
- <- time .After (toRenewal + 500 * time .Millisecond )
1268
+ time .Sleep (toRenewal + 500 * time .Millisecond )
1269
1269
assert .Nil (t , cancel ())
1270
1270
1271
1271
select {
@@ -1274,7 +1274,7 @@ func TestEntraidTokenManager_Streaming(t *testing.T) {
1274
1274
case <- tm .closedChan :
1275
1275
}
1276
1276
1277
- <- time .After (50 * time .Millisecond )
1277
+ time .Sleep (50 * time .Millisecond )
1278
1278
1279
1279
// maxAttempts + the initial one
1280
1280
idp .AssertNumberOfCalls (t , "RequestToken" , 2 )
0 commit comments