mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 00:47:33 +00:00
chore: improve integration tests (#8727)
Improve integration tests: - spliting the tests in TokenExchange to isolated instances and in parallel - corrected some test structure so that the check for Details is no done anymore if the test already failed - replace required-calls with assert-calls to not stop the testing - add gofakeit for application, project and usernames(emails) - add eventually checks for testing in actions v2, so the request only get called when the execution is defined - check for length of results in list/search endpoints to avoid index errors
This commit is contained in:
@@ -35,19 +35,18 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func await(t *testing.T, ctx context.Context, cb func(*assert.CollectT)) {
|
||||
deadline, ok := ctx.Deadline()
|
||||
require.True(t, ok, "context must have deadline")
|
||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(ctx, time.Minute)
|
||||
require.EventuallyWithT(
|
||||
t,
|
||||
func(tt *assert.CollectT) {
|
||||
defer func() {
|
||||
// Panics are not recovered and don't mark the test as failed, so we need to do that ourselves
|
||||
require.Nil(t, recover(), "panic in await callback")
|
||||
assert.Nil(tt, recover(), "panic in await callback")
|
||||
}()
|
||||
cb(tt)
|
||||
},
|
||||
time.Until(deadline),
|
||||
time.Second,
|
||||
retryDuration,
|
||||
tick,
|
||||
"awaiting successful callback failed",
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user