mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-26 14:28:46 +00:00
test: no location header in response (#8441)
# Which Problems Are Solved Sometimes integrations tests are failing with an error `http: no location header in response`. The underlying cause was hidden, as in some tests we assumed a 3xx range response but got a 4xx response instead. No assertion on the status code was made, resulting in the above error message on calling `resp.Location()`. The underlying issue, the application not found in the projection, is also fixed. # How the Problems Are Solved This change adds a check for the status code and returns the response body if the response is not in the 3xx status code range. Helper function that create applications now do an additional `GetAppByID` in a retry loop to ensure consitency in the projection before proceeding with tests. # Additional Changes - none # Additional Context - Pipline failures were observed, no issue was created - Cherry-picked form WIP #8407 Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
co-authored by
Livio Spring
parent
c8e2a3bd49
commit
10d5fc6184
@@ -431,3 +431,19 @@ func (s *Tester) updateInstanceAndOrg(ctx context.Context, domain string) contex
|
||||
logging.OnError(err).Fatal("query organisation")
|
||||
return ctx
|
||||
}
|
||||
|
||||
func await(af func() error) error {
|
||||
maxTimer := time.NewTimer(15 * time.Minute)
|
||||
for {
|
||||
err := af()
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
select {
|
||||
case <-maxTimer.C:
|
||||
return err
|
||||
case <-time.After(time.Second / 10):
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user