mirror of
https://github.com/zitadel/zitadel.git
synced 2025-07-12 23:38:31 +00:00
chore: correct integration tests for query endpoints eventual consistent (#9554)
# Which Problems Are Solved Integration tests for OIDC service failed irregularly. # How the Problems Are Solved Add eventual consistent checks for querying endpoints to the integration tests for the OIDC service. # Additional Changes None # Additional Context None
This commit is contained in:
parent
599850e7e8
commit
6cd5e717a4
@ -77,19 +77,22 @@ func TestServer_GetAuthRequest(t *testing.T) {
|
|||||||
now, authRequestID, err := tt.dep()
|
now, authRequestID, err := tt.dep()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(CTX, time.Minute)
|
||||||
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, err := Client.GetAuthRequest(tt.ctx, &oidc_pb.GetAuthRequestRequest{
|
got, err := Client.GetAuthRequest(tt.ctx, &oidc_pb.GetAuthRequestRequest{
|
||||||
AuthRequestId: authRequestID,
|
AuthRequestId: authRequestID,
|
||||||
})
|
})
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
require.Error(t, err)
|
assert.Error(ttt, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
require.NoError(t, err)
|
assert.NoError(ttt, err)
|
||||||
authRequest := got.GetAuthRequest()
|
authRequest := got.GetAuthRequest()
|
||||||
assert.NotNil(t, authRequest)
|
assert.NotNil(ttt, authRequest)
|
||||||
assert.Equal(t, authRequestID, authRequest.GetId())
|
assert.Equal(ttt, authRequestID, authRequest.GetId())
|
||||||
assert.WithinRange(t, authRequest.GetCreationDate().AsTime(), now.Add(-time.Second), now.Add(time.Second))
|
assert.WithinRange(ttt, authRequest.GetCreationDate().AsTime(), now.Add(-time.Second), now.Add(time.Second))
|
||||||
assert.Contains(t, authRequest.GetScope(), "openid")
|
assert.Contains(ttt, authRequest.GetScope(), "openid")
|
||||||
|
}, retryDuration, tick)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -671,21 +674,24 @@ func TestServer_GetDeviceAuthorizationRequest(t *testing.T) {
|
|||||||
deviceAuth, err := tt.dep()
|
deviceAuth, err := tt.dep()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(CTX, time.Minute)
|
||||||
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, err := Client.GetDeviceAuthorizationRequest(tt.ctx, &oidc_pb.GetDeviceAuthorizationRequestRequest{
|
got, err := Client.GetDeviceAuthorizationRequest(tt.ctx, &oidc_pb.GetDeviceAuthorizationRequestRequest{
|
||||||
UserCode: deviceAuth.UserCode,
|
UserCode: deviceAuth.UserCode,
|
||||||
})
|
})
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
require.Error(t, err)
|
assert.Error(ttt, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
require.NoError(t, err)
|
assert.NoError(ttt, err)
|
||||||
authRequest := got.GetDeviceAuthorizationRequest()
|
authRequest := got.GetDeviceAuthorizationRequest()
|
||||||
assert.NotNil(t, authRequest)
|
assert.NotNil(ttt, authRequest)
|
||||||
assert.NotEmpty(t, authRequest.GetId())
|
assert.NotEmpty(ttt, authRequest.GetId())
|
||||||
assert.Equal(t, client.GetClientId(), authRequest.GetClientId())
|
assert.Equal(ttt, client.GetClientId(), authRequest.GetClientId())
|
||||||
assert.Contains(t, authRequest.GetScope(), "openid")
|
assert.Contains(ttt, authRequest.GetScope(), "openid")
|
||||||
assert.NotEmpty(t, authRequest.GetAppName())
|
assert.NotEmpty(ttt, authRequest.GetAppName())
|
||||||
assert.NotEmpty(t, authRequest.GetProjectName())
|
assert.NotEmpty(ttt, authRequest.GetProjectName())
|
||||||
|
}, retryDuration, tick)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,19 +76,22 @@ func TestServer_GetAuthRequest(t *testing.T) {
|
|||||||
now, authRequestID, err := tt.dep()
|
now, authRequestID, err := tt.dep()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(CTX, time.Minute)
|
||||||
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, err := Client.GetAuthRequest(tt.ctx, &oidc_pb.GetAuthRequestRequest{
|
got, err := Client.GetAuthRequest(tt.ctx, &oidc_pb.GetAuthRequestRequest{
|
||||||
AuthRequestId: authRequestID,
|
AuthRequestId: authRequestID,
|
||||||
})
|
})
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
require.Error(t, err)
|
assert.Error(ttt, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
require.NoError(t, err)
|
assert.NoError(ttt, err)
|
||||||
authRequest := got.GetAuthRequest()
|
authRequest := got.GetAuthRequest()
|
||||||
assert.NotNil(t, authRequest)
|
assert.NotNil(ttt, authRequest)
|
||||||
assert.Equal(t, authRequestID, authRequest.GetId())
|
assert.Equal(ttt, authRequestID, authRequest.GetId())
|
||||||
assert.WithinRange(t, authRequest.GetCreationDate().AsTime(), now.Add(-time.Second), now.Add(time.Second))
|
assert.WithinRange(ttt, authRequest.GetCreationDate().AsTime(), now.Add(-time.Second), now.Add(time.Second))
|
||||||
assert.Contains(t, authRequest.GetScope(), "openid")
|
assert.Contains(ttt, authRequest.GetScope(), "openid")
|
||||||
|
}, retryDuration, tick)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user