@@ -123,8 +123,17 @@ func CreateCfgmgmtActionsDiagnostic() diagnostics.Diagnostic {
123
123
maxTries := 5
124
124
125
125
for _ , entity := range loaded .CreatedEntities {
126
- reqPath := fmt .Sprintf ("/api/v0/eventfeed?collapse=true&page_size=100&start=%d&end=%d" , entity .RecordedAtMillis - 1 , entity .RecordedAtMillis + 1 )
126
+ reqPath := fmt .Sprintf ("/api/v0/eventfeed?collapse=true&page_size=100&start=%d&end=%d" , entity .RecordedAtMillis - 1000 , entity .RecordedAtMillis + 1000 )
127
127
found := false
128
+
129
+ type eventsFeedResp struct {
130
+ Events []struct {
131
+ EntityName string `json:"entity_name"`
132
+ } `json:"events"`
133
+ }
134
+
135
+ respUnmarshalled := eventsFeedResp {}
136
+
128
137
RETRY_LOOP:
129
138
for {
130
139
resp , err := tstCtx .DoLBRequest (reqPath )
@@ -137,13 +146,7 @@ func CreateCfgmgmtActionsDiagnostic() diagnostics.Diagnostic {
137
146
// We wont retry a flakey backend. It should always return 200
138
147
require .Equal (tstCtx , 200 , resp .StatusCode , "Failed to GET %s" , reqPath )
139
148
140
- type eventsFeedResp struct {
141
- Events []struct {
142
- EntityName string `json:"entity_name"`
143
- } `json:"events"`
144
- }
145
-
146
- respUnmarshalled := eventsFeedResp {}
149
+ respUnmarshalled = eventsFeedResp {}
147
150
err = json .NewDecoder (resp .Body ).Decode (& respUnmarshalled )
148
151
// We should always get valid json
149
152
require .NoError (tstCtx , err , "Failed to decode body of GET %s" , reqPath )
@@ -158,9 +161,9 @@ func CreateCfgmgmtActionsDiagnostic() diagnostics.Diagnostic {
158
161
if tries >= maxTries {
159
162
break RETRY_LOOP
160
163
}
161
- time .Sleep (2 * time .Duration (tries ) * time .Second )
164
+ time .Sleep (5 * time .Duration (tries ) * time .Second )
162
165
}
163
- assert .True (tstCtx , found , "Could not find entity %s in GET %s" , entity .EntityName , reqPath )
166
+ assert .True (tstCtx , found , "Could not find entity %s in GET %s; did get %+v " , entity .EntityName , reqPath , respUnmarshalled )
164
167
}
165
168
166
169
},
0 commit comments