@@ -2883,8 +2883,12 @@ func TestAPI(t *testing.T) {
2883
2883
Op : fsnotify .Write ,
2884
2884
})
2885
2885
2886
- err = api .RefreshContainers (ctx )
2887
- require .NoError (t , err )
2886
+ require .Eventuallyf (t , func () bool {
2887
+ err = api .RefreshContainers (ctx )
2888
+ require .NoError (t , err )
2889
+
2890
+ return len (fakeSAC .agents ) == 1
2891
+ }, testutil .WaitShort , testutil .IntervalFast , "subagent should be created after config change" )
2888
2892
2889
2893
t .Log ("Phase 2: Cont, waiting for sub agent to exit" )
2890
2894
exitSubAgentOnce .Do (func () {
@@ -2919,8 +2923,12 @@ func TestAPI(t *testing.T) {
2919
2923
Op : fsnotify .Write ,
2920
2924
})
2921
2925
2922
- err = api .RefreshContainers (ctx )
2923
- require .NoError (t , err )
2926
+ require .Eventuallyf (t , func () bool {
2927
+ err = api .RefreshContainers (ctx )
2928
+ require .NoError (t , err )
2929
+
2930
+ return len (fakeSAC .agents ) == 0
2931
+ }, testutil .WaitShort , testutil .IntervalFast , "subagent should be deleted after config change" )
2924
2932
2925
2933
req = httptest .NewRequest (http .MethodGet , "/" , nil ).WithContext (ctx )
2926
2934
rec = httptest .NewRecorder ()
0 commit comments