mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-07 07:28:57 +00:00
chore: correct require usage to assert for eventual consistency (#8795)
Some checks are pending
ZITADEL CI/CD / core (push) Waiting to run
ZITADEL CI/CD / console (push) Waiting to run
ZITADEL CI/CD / version (push) Waiting to run
ZITADEL CI/CD / core-integration-test (push) Blocked by required conditions
ZITADEL CI/CD / lint (push) Blocked by required conditions
ZITADEL CI/CD / compile (push) Blocked by required conditions
ZITADEL CI/CD / core-unit-test (push) Blocked by required conditions
ZITADEL CI/CD / container (push) Blocked by required conditions
ZITADEL CI/CD / e2e (push) Blocked by required conditions
ZITADEL CI/CD / release (push) Blocked by required conditions
Code Scanning / CodeQL-Build (go) (push) Waiting to run
Code Scanning / CodeQL-Build (javascript) (push) Waiting to run
Some checks are pending
ZITADEL CI/CD / core (push) Waiting to run
ZITADEL CI/CD / console (push) Waiting to run
ZITADEL CI/CD / version (push) Waiting to run
ZITADEL CI/CD / core-integration-test (push) Blocked by required conditions
ZITADEL CI/CD / lint (push) Blocked by required conditions
ZITADEL CI/CD / compile (push) Blocked by required conditions
ZITADEL CI/CD / core-unit-test (push) Blocked by required conditions
ZITADEL CI/CD / container (push) Blocked by required conditions
ZITADEL CI/CD / e2e (push) Blocked by required conditions
ZITADEL CI/CD / release (push) Blocked by required conditions
Code Scanning / CodeQL-Build (go) (push) Waiting to run
Code Scanning / CodeQL-Build (javascript) (push) Waiting to run
# Which Problems Are Solved Eventual consistency is handled wrongly in the newly improved integration tests. # How the Problems Are Solved Correct the usage of the require package with the assert package where necessary, to remove the panics where the EventuallyWithT functions can rerun. # Additional Changes Modify the timeout values for some EventuallyWithT which can vary when a instance is freshly setup. # Additional Context None
This commit is contained in:
parent
11782cf422
commit
fca6b28a97
@ -92,7 +92,7 @@ func TestServer_ListIAMMembers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(tt.args.ctx, 20*time.Second)
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(tt.args.ctx, time.Minute)
|
||||||
assert.EventuallyWithT(t, func(ct *assert.CollectT) {
|
assert.EventuallyWithT(t, func(ct *assert.CollectT) {
|
||||||
got, err := Client.ListIAMMembers(tt.args.ctx, tt.args.req)
|
got, err := Client.ListIAMMembers(tt.args.ctx, tt.args.req)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
@ -103,10 +103,11 @@ func TestServer_ListIAMMembers(t *testing.T) {
|
|||||||
wantResult := tt.want.GetResult()
|
wantResult := tt.want.GetResult()
|
||||||
gotResult := got.GetResult()
|
gotResult := got.GetResult()
|
||||||
|
|
||||||
require.Len(ct, gotResult, len(wantResult))
|
if assert.Len(ct, gotResult, len(wantResult)) {
|
||||||
for i, want := range wantResult {
|
for i, want := range wantResult {
|
||||||
assert.Equal(ct, want.GetUserId(), gotResult[i].GetUserId())
|
assert.Equal(ct, want.GetUserId(), gotResult[i].GetUserId())
|
||||||
assert.ElementsMatch(ct, want.GetRoles(), gotResult[i].GetRoles())
|
assert.ElementsMatch(ct, want.GetRoles(), gotResult[i].GetRoles())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, retryDuration, tick)
|
}, retryDuration, tick)
|
||||||
})
|
})
|
||||||
|
@ -54,7 +54,7 @@ func TestServer_GetSecurityPolicy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(tt.ctx, 5*time.Second)
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(tt.ctx, time.Minute)
|
||||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
resp, err := instance.Client.Admin.GetSecurityPolicy(tt.ctx, &admin_pb.GetSecurityPolicyRequest{})
|
resp, err := instance.Client.Admin.GetSecurityPolicy(tt.ctx, &admin_pb.GetSecurityPolicyRequest{})
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
|
@ -411,17 +411,17 @@ func TestServer_ListOrganizations(t *testing.T) {
|
|||||||
// totalResult is unrelated to the tests here so gets carried over, can vary from the count of results due to permissions
|
// totalResult is unrelated to the tests here so gets carried over, can vary from the count of results due to permissions
|
||||||
tt.want.Details.TotalResult = got.Details.TotalResult
|
tt.want.Details.TotalResult = got.Details.TotalResult
|
||||||
// always first check length, otherwise its failed anyway
|
// always first check length, otherwise its failed anyway
|
||||||
require.Len(ttt, got.Result, len(tt.want.Result))
|
if assert.Len(ttt, got.Result, len(tt.want.Result)) {
|
||||||
|
for i := range tt.want.Result {
|
||||||
|
// domain from result, as it is generated though the create
|
||||||
|
tt.want.Result[i].PrimaryDomain = got.Result[i].PrimaryDomain
|
||||||
|
// sequence from result, as it can be with different sequence from create
|
||||||
|
tt.want.Result[i].Details.Sequence = got.Result[i].Details.Sequence
|
||||||
|
}
|
||||||
|
|
||||||
for i := range tt.want.Result {
|
for i := range tt.want.Result {
|
||||||
// domain from result, as it is generated though the create
|
assert.Contains(ttt, got.Result, tt.want.Result[i])
|
||||||
tt.want.Result[i].PrimaryDomain = got.Result[i].PrimaryDomain
|
}
|
||||||
// sequence from result, as it can be with different sequence from create
|
|
||||||
tt.want.Result[i].Details.Sequence = got.Result[i].Details.Sequence
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := range tt.want.Result {
|
|
||||||
assert.Contains(ttt, got.Result, tt.want.Result[i])
|
|
||||||
}
|
}
|
||||||
integration.AssertListDetails(t, tt.want, got)
|
integration.AssertListDetails(t, tt.want, got)
|
||||||
}, retryDuration, tick, "timeout waiting for expected user result")
|
}, retryDuration, tick, "timeout waiting for expected user result")
|
||||||
|
@ -255,7 +255,7 @@ func TestServer_ExecutionTarget(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer close()
|
defer close()
|
||||||
}
|
}
|
||||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, 5*time.Second)
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, time.Minute)
|
||||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, err := instance.Client.ActionV3Alpha.GetTarget(tt.ctx, tt.req)
|
got, err := instance.Client.ActionV3Alpha.GetTarget(tt.ctx, tt.req)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
@ -278,7 +278,7 @@ func TestServer_ExecutionTarget(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func waitForExecutionOnCondition(ctx context.Context, t *testing.T, instance *integration.Instance, condition *action.Condition) {
|
func waitForExecutionOnCondition(ctx context.Context, t *testing.T, instance *integration.Instance, condition *action.Condition) {
|
||||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(ctx, 5*time.Second)
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(ctx, time.Minute)
|
||||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, err := instance.Client.ActionV3Alpha.SearchExecutions(ctx, &action.SearchExecutionsRequest{
|
got, err := instance.Client.ActionV3Alpha.SearchExecutions(ctx, &action.SearchExecutionsRequest{
|
||||||
Filters: []*action.ExecutionSearchFilter{
|
Filters: []*action.ExecutionSearchFilter{
|
||||||
@ -290,9 +290,7 @@ func waitForExecutionOnCondition(ctx context.Context, t *testing.T, instance *in
|
|||||||
if !assert.NoError(ttt, err) {
|
if !assert.NoError(ttt, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if assert.Len(ttt, got.GetResult(), 1) {
|
assert.Len(ttt, got.GetResult(), 1)
|
||||||
return
|
|
||||||
}
|
|
||||||
}, retryDuration, tick, "timeout waiting for expected execution result")
|
}, retryDuration, tick, "timeout waiting for expected execution result")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -216,14 +216,14 @@ func TestServer_GetTarget(t *testing.T) {
|
|||||||
err := tt.args.dep(tt.args.ctx, tt.args.req, tt.want)
|
err := tt.args.dep(tt.args.ctx, tt.args.req, tt.want)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, 5*time.Second)
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, time.Minute)
|
||||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, err := instance.Client.ActionV3Alpha.GetTarget(tt.args.ctx, tt.args.req)
|
got, err := instance.Client.ActionV3Alpha.GetTarget(tt.args.ctx, tt.args.req)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
require.Error(ttt, err, "Error: "+err.Error())
|
assert.Error(ttt, err, "Error: "+err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
require.NoError(ttt, err)
|
assert.NoError(ttt, err)
|
||||||
|
|
||||||
wantTarget := tt.want.GetTarget()
|
wantTarget := tt.want.GetTarget()
|
||||||
gotTarget := got.GetTarget()
|
gotTarget := got.GetTarget()
|
||||||
@ -478,7 +478,7 @@ func TestServer_ListTargets(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, 5*time.Second)
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, time.Minute)
|
||||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, listErr := instance.Client.ActionV3Alpha.SearchTargets(tt.args.ctx, tt.args.req)
|
got, listErr := instance.Client.ActionV3Alpha.SearchTargets(tt.args.ctx, tt.args.req)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
@ -488,11 +488,11 @@ func TestServer_ListTargets(t *testing.T) {
|
|||||||
require.NoError(ttt, listErr)
|
require.NoError(ttt, listErr)
|
||||||
|
|
||||||
// always first check length, otherwise its failed anyway
|
// always first check length, otherwise its failed anyway
|
||||||
require.Len(ttt, got.Result, len(tt.want.Result))
|
if assert.Len(ttt, got.Result, len(tt.want.Result)) {
|
||||||
|
for i := range tt.want.Result {
|
||||||
for i := range tt.want.Result {
|
integration.AssertResourceDetails(ttt, tt.want.Result[i].GetDetails(), got.Result[i].GetDetails())
|
||||||
integration.AssertResourceDetails(ttt, tt.want.Result[i].GetDetails(), got.Result[i].GetDetails())
|
assert.EqualExportedValues(ttt, tt.want.Result[i].GetConfig(), got.Result[i].GetConfig())
|
||||||
assert.EqualExportedValues(ttt, tt.want.Result[i].GetConfig(), got.Result[i].GetConfig())
|
}
|
||||||
}
|
}
|
||||||
integration.AssertResourceListDetails(ttt, tt.want, got)
|
integration.AssertResourceListDetails(ttt, tt.want, got)
|
||||||
}, retryDuration, tick, "timeout waiting for expected execution result")
|
}, retryDuration, tick, "timeout waiting for expected execution result")
|
||||||
@ -863,7 +863,7 @@ func TestServer_SearchExecutions(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, 5*time.Second)
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, time.Minute)
|
||||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, listErr := instance.Client.ActionV3Alpha.SearchExecutions(tt.args.ctx, tt.args.req)
|
got, listErr := instance.Client.ActionV3Alpha.SearchExecutions(tt.args.ctx, tt.args.req)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
@ -872,14 +872,15 @@ func TestServer_SearchExecutions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
require.NoError(ttt, listErr)
|
require.NoError(ttt, listErr)
|
||||||
// always first check length, otherwise its failed anyway
|
// always first check length, otherwise its failed anyway
|
||||||
require.Len(ttt, got.Result, len(tt.want.Result))
|
if assert.Len(ttt, got.Result, len(tt.want.Result)) {
|
||||||
for i := range tt.want.Result {
|
for i := range tt.want.Result {
|
||||||
// as not sorted, all elements have to be checked
|
// as not sorted, all elements have to be checked
|
||||||
// workaround as oneof elements can only be checked with assert.EqualExportedValues()
|
// workaround as oneof elements can only be checked with assert.EqualExportedValues()
|
||||||
if j, found := containExecution(got.Result, tt.want.Result[i]); found {
|
if j, found := containExecution(got.Result, tt.want.Result[i]); found {
|
||||||
integration.AssertResourceDetails(ttt, tt.want.Result[i].GetDetails(), got.Result[j].GetDetails())
|
integration.AssertResourceDetails(ttt, tt.want.Result[i].GetDetails(), got.Result[j].GetDetails())
|
||||||
got.Result[j].Details = tt.want.Result[i].GetDetails()
|
got.Result[j].Details = tt.want.Result[i].GetDetails()
|
||||||
assert.EqualExportedValues(ttt, tt.want.Result[i], got.Result[j])
|
assert.EqualExportedValues(ttt, tt.want.Result[i], got.Result[j])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
integration.AssertResourceListDetails(ttt, tt.want, got)
|
integration.AssertResourceListDetails(ttt, tt.want, got)
|
||||||
|
@ -44,7 +44,7 @@ func ensureFeatureEnabled(t *testing.T, instance *integration.Instance) {
|
|||||||
})
|
})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(ctx, time.Minute)
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(ctx, 5*time.Minute)
|
||||||
require.EventuallyWithT(t,
|
require.EventuallyWithT(t,
|
||||||
func(ttt *assert.CollectT) {
|
func(ttt *assert.CollectT) {
|
||||||
f, err := instance.Client.FeatureV2.GetInstanceFeatures(ctx, &feature.GetInstanceFeaturesRequest{
|
f, err := instance.Client.FeatureV2.GetInstanceFeatures(ctx, &feature.GetInstanceFeaturesRequest{
|
||||||
@ -54,10 +54,10 @@ func ensureFeatureEnabled(t *testing.T, instance *integration.Instance) {
|
|||||||
assert.True(ttt, f.Actions.GetEnabled())
|
assert.True(ttt, f.Actions.GetEnabled())
|
||||||
},
|
},
|
||||||
retryDuration,
|
retryDuration,
|
||||||
time.Second,
|
tick,
|
||||||
"timed out waiting for ensuring instance feature")
|
"timed out waiting for ensuring instance feature")
|
||||||
|
|
||||||
retryDuration, tick = integration.WaitForAndTickWithMaxDuration(ctx, time.Minute)
|
retryDuration, tick = integration.WaitForAndTickWithMaxDuration(ctx, 5*time.Minute)
|
||||||
require.EventuallyWithT(t,
|
require.EventuallyWithT(t,
|
||||||
func(ttt *assert.CollectT) {
|
func(ttt *assert.CollectT) {
|
||||||
_, err := instance.Client.ActionV3Alpha.ListExecutionMethods(ctx, &action.ListExecutionMethodsRequest{})
|
_, err := instance.Client.ActionV3Alpha.ListExecutionMethods(ctx, &action.ListExecutionMethodsRequest{})
|
||||||
|
@ -188,7 +188,7 @@ func TestServer_ListUserSchemas(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, 20*time.Second)
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, time.Minute)
|
||||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, err := instance.Client.UserSchemaV3.SearchUserSchemas(tt.args.ctx, tt.args.req)
|
got, err := instance.Client.UserSchemaV3.SearchUserSchemas(tt.args.ctx, tt.args.req)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
@ -197,14 +197,15 @@ func TestServer_ListUserSchemas(t *testing.T) {
|
|||||||
}
|
}
|
||||||
require.NoError(ttt, err)
|
require.NoError(ttt, err)
|
||||||
// always first check length, otherwise its failed anyway
|
// always first check length, otherwise its failed anyway
|
||||||
require.Len(ttt, got.Result, len(tt.want.Result))
|
if assert.Len(ttt, got.Result, len(tt.want.Result)) {
|
||||||
for i := range tt.want.Result {
|
for i := range tt.want.Result {
|
||||||
wantSchema := tt.want.Result[i]
|
wantSchema := tt.want.Result[i]
|
||||||
gotSchema := got.Result[i]
|
gotSchema := got.Result[i]
|
||||||
|
|
||||||
integration.AssertResourceDetails(ttt, wantSchema.GetDetails(), gotSchema.GetDetails())
|
integration.AssertResourceDetails(ttt, wantSchema.GetDetails(), gotSchema.GetDetails())
|
||||||
wantSchema.Details = gotSchema.GetDetails()
|
wantSchema.Details = gotSchema.GetDetails()
|
||||||
grpc.AllFieldsEqual(ttt, wantSchema.ProtoReflect(), gotSchema.ProtoReflect(), grpc.CustomMappers)
|
grpc.AllFieldsEqual(ttt, wantSchema.ProtoReflect(), gotSchema.ProtoReflect(), grpc.CustomMappers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
integration.AssertListDetails(ttt, tt.want, got)
|
integration.AssertListDetails(ttt, tt.want, got)
|
||||||
}, retryDuration, tick, "timeout waiting for expected user schema result")
|
}, retryDuration, tick, "timeout waiting for expected user schema result")
|
||||||
@ -295,14 +296,14 @@ func TestServer_GetUserSchema(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, 5*time.Second)
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, time.Minute)
|
||||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, err := instance.Client.UserSchemaV3.GetUserSchema(tt.args.ctx, tt.args.req)
|
got, err := instance.Client.UserSchemaV3.GetUserSchema(tt.args.ctx, tt.args.req)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
require.Error(ttt, err, "Error: "+err.Error())
|
assert.Error(ttt, err, "Error: "+err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
require.NoError(ttt, err)
|
assert.NoError(ttt, err)
|
||||||
|
|
||||||
wantSchema := tt.want.GetUserSchema()
|
wantSchema := tt.want.GetUserSchema()
|
||||||
gotSchema := got.GetUserSchema()
|
gotSchema := got.GetUserSchema()
|
||||||
|
@ -53,14 +53,16 @@ func TestServer_GetSecuritySettings(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(tt.ctx, 20*time.Second)
|
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(tt.ctx, time.Minute)
|
||||||
assert.EventuallyWithT(t, func(ct *assert.CollectT) {
|
assert.EventuallyWithT(t, func(ct *assert.CollectT) {
|
||||||
resp, err := Client.GetSecuritySettings(tt.ctx, &settings.GetSecuritySettingsRequest{})
|
resp, err := Client.GetSecuritySettings(tt.ctx, &settings.GetSecuritySettingsRequest{})
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
require.Error(ct, err)
|
assert.Error(ct, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !assert.NoError(ct, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
require.NoError(ct, err)
|
|
||||||
got, want := resp.GetSettings(), tt.want.GetSettings()
|
got, want := resp.GetSettings(), tt.want.GetSettings()
|
||||||
assert.Equal(ct, want.GetEmbeddedIframe().GetEnabled(), got.GetEmbeddedIframe().GetEnabled(), "enable iframe embedding")
|
assert.Equal(ct, want.GetEmbeddedIframe().GetEnabled(), got.GetEmbeddedIframe().GetEnabled(), "enable iframe embedding")
|
||||||
assert.Equal(ct, want.GetEmbeddedIframe().GetAllowedOrigins(), got.GetEmbeddedIframe().GetAllowedOrigins(), "allowed origins")
|
assert.Equal(ct, want.GetEmbeddedIframe().GetAllowedOrigins(), got.GetEmbeddedIframe().GetAllowedOrigins(), "allowed origins")
|
||||||
|
@ -57,10 +57,12 @@ func TestServer_GetSecuritySettings(t *testing.T) {
|
|||||||
assert.EventuallyWithT(t, func(ct *assert.CollectT) {
|
assert.EventuallyWithT(t, func(ct *assert.CollectT) {
|
||||||
resp, err := Client.GetSecuritySettings(tt.ctx, &settings.GetSecuritySettingsRequest{})
|
resp, err := Client.GetSecuritySettings(tt.ctx, &settings.GetSecuritySettingsRequest{})
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
require.Error(ct, err)
|
assert.Error(ct, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !assert.NoError(ct, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
require.NoError(ct, err)
|
|
||||||
got, want := resp.GetSettings(), tt.want.GetSettings()
|
got, want := resp.GetSettings(), tt.want.GetSettings()
|
||||||
assert.Equal(ct, want.GetEmbeddedIframe().GetEnabled(), got.GetEmbeddedIframe().GetEnabled(), "enable iframe embedding")
|
assert.Equal(ct, want.GetEmbeddedIframe().GetEnabled(), got.GetEmbeddedIframe().GetEnabled(), "enable iframe embedding")
|
||||||
assert.Equal(ct, want.GetEmbeddedIframe().GetAllowedOrigins(), got.GetEmbeddedIframe().GetAllowedOrigins(), "allowed origins")
|
assert.Equal(ct, want.GetEmbeddedIframe().GetAllowedOrigins(), got.GetEmbeddedIframe().GetAllowedOrigins(), "allowed origins")
|
||||||
|
@ -245,9 +245,10 @@ func TestServer_ListIDPLinks(t *testing.T) {
|
|||||||
}
|
}
|
||||||
require.NoError(ttt, err)
|
require.NoError(ttt, err)
|
||||||
// always first check length, otherwise its failed anyway
|
// always first check length, otherwise its failed anyway
|
||||||
require.Len(ttt, got.Result, len(tt.want.Result))
|
if assert.Len(ttt, got.Result, len(tt.want.Result)) {
|
||||||
for i := range tt.want.Result {
|
for i := range tt.want.Result {
|
||||||
assert.Contains(ttt, got.Result, tt.want.Result[i])
|
assert.Contains(ttt, got.Result, tt.want.Result[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
integration.AssertListDetails(t, tt.want, got)
|
integration.AssertListDetails(t, tt.want, got)
|
||||||
}, retryDuration, tick, "timeout waiting for expected idplinks result")
|
}, retryDuration, tick, "timeout waiting for expected idplinks result")
|
||||||
|
@ -593,9 +593,10 @@ func TestServer_ListPasskeys(t *testing.T) {
|
|||||||
}
|
}
|
||||||
require.NoError(ttt, err)
|
require.NoError(ttt, err)
|
||||||
// always first check length, otherwise its failed anyway
|
// always first check length, otherwise its failed anyway
|
||||||
assert.Len(ttt, got.Result, len(tt.want.Result))
|
if assert.Len(ttt, got.Result, len(tt.want.Result)) {
|
||||||
for i := range tt.want.Result {
|
for i := range tt.want.Result {
|
||||||
assert.Contains(ttt, got.Result, tt.want.Result[i])
|
assert.Contains(ttt, got.Result, tt.want.Result[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
integration.AssertListDetails(ttt, tt.want, got)
|
integration.AssertListDetails(ttt, tt.want, got)
|
||||||
}, retryDuration, tick, "timeout waiting for expected idplinks result")
|
}, retryDuration, tick, "timeout waiting for expected idplinks result")
|
||||||
|
@ -162,10 +162,12 @@ func TestServer_GetUserByID(t *testing.T) {
|
|||||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, err := Client.GetUserByID(tt.args.ctx, tt.args.req)
|
got, err := Client.GetUserByID(tt.args.ctx, tt.args.req)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
require.Error(ttt, err)
|
assert.Error(ttt, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !assert.NoError(ttt, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
require.NoError(ttt, err)
|
|
||||||
|
|
||||||
tt.want.User.Details = userAttr.Details
|
tt.want.User.Details = userAttr.Details
|
||||||
tt.want.User.UserId = userAttr.UserID
|
tt.want.User.UserId = userAttr.UserID
|
||||||
@ -912,27 +914,27 @@ func TestServer_ListUsers(t *testing.T) {
|
|||||||
// always only give back dependency infos which are required for the response
|
// always only give back dependency infos which are required for the response
|
||||||
require.Len(ttt, tt.want.Result, len(infos))
|
require.Len(ttt, tt.want.Result, len(infos))
|
||||||
// always first check length, otherwise its failed anyway
|
// always first check length, otherwise its failed anyway
|
||||||
require.Len(ttt, got.Result, len(tt.want.Result))
|
if assert.Len(ttt, got.Result, len(tt.want.Result)) {
|
||||||
|
// totalResult is unrelated to the tests here so gets carried over, can vary from the count of results due to permissions
|
||||||
|
tt.want.Details.TotalResult = got.Details.TotalResult
|
||||||
|
|
||||||
// totalResult is unrelated to the tests here so gets carried over, can vary from the count of results due to permissions
|
// fill in userid and username as it is generated
|
||||||
tt.want.Details.TotalResult = got.Details.TotalResult
|
for i := range infos {
|
||||||
|
tt.want.Result[i].UserId = infos[i].UserID
|
||||||
// fill in userid and username as it is generated
|
tt.want.Result[i].Username = infos[i].Username
|
||||||
for i := range infos {
|
tt.want.Result[i].PreferredLoginName = infos[i].Username
|
||||||
tt.want.Result[i].UserId = infos[i].UserID
|
tt.want.Result[i].LoginNames = []string{infos[i].Username}
|
||||||
tt.want.Result[i].Username = infos[i].Username
|
if human := tt.want.Result[i].GetHuman(); human != nil {
|
||||||
tt.want.Result[i].PreferredLoginName = infos[i].Username
|
human.Email.Email = infos[i].Username
|
||||||
tt.want.Result[i].LoginNames = []string{infos[i].Username}
|
if tt.want.Result[i].GetHuman().GetPasswordChanged() != nil {
|
||||||
if human := tt.want.Result[i].GetHuman(); human != nil {
|
human.PasswordChanged = infos[i].Changed
|
||||||
human.Email.Email = infos[i].Username
|
}
|
||||||
if tt.want.Result[i].GetHuman().GetPasswordChanged() != nil {
|
|
||||||
human.PasswordChanged = infos[i].Changed
|
|
||||||
}
|
}
|
||||||
|
tt.want.Result[i].Details = infos[i].Details
|
||||||
|
}
|
||||||
|
for i := range tt.want.Result {
|
||||||
|
assert.Contains(ttt, got.Result, tt.want.Result[i])
|
||||||
}
|
}
|
||||||
tt.want.Result[i].Details = infos[i].Details
|
|
||||||
}
|
|
||||||
for i := range tt.want.Result {
|
|
||||||
assert.Contains(ttt, got.Result, tt.want.Result[i])
|
|
||||||
}
|
}
|
||||||
integration.AssertListDetails(ttt, tt.want, got)
|
integration.AssertListDetails(ttt, tt.want, got)
|
||||||
}, retryDuration, tick, "timeout waiting for expected user result")
|
}, retryDuration, tick, "timeout waiting for expected user result")
|
||||||
|
@ -171,10 +171,12 @@ func TestServer_GetUserByID(t *testing.T) {
|
|||||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, err := Client.GetUserByID(tt.args.ctx, tt.args.req)
|
got, err := Client.GetUserByID(tt.args.ctx, tt.args.req)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
require.Error(t, err)
|
assert.Error(ttt, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !assert.NoError(ttt, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
tt.want.User.Details = detailsV2ToV2beta(userAttr.Details)
|
tt.want.User.Details = detailsV2ToV2beta(userAttr.Details)
|
||||||
tt.want.User.UserId = userAttr.UserID
|
tt.want.User.UserId = userAttr.UserID
|
||||||
@ -188,7 +190,7 @@ func TestServer_GetUserByID(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert.Equal(ttt, tt.want.User, got.User)
|
assert.Equal(ttt, tt.want.User, got.User)
|
||||||
integration.AssertDetails(t, tt.want, got)
|
integration.AssertDetails(ttt, tt.want, got)
|
||||||
}, retryDuration, tick)
|
}, retryDuration, tick)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -314,10 +316,13 @@ func TestServer_GetUserByID_Permission(t *testing.T) {
|
|||||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||||
got, err := Client.GetUserByID(tt.args.ctx, tt.args.req)
|
got, err := Client.GetUserByID(tt.args.ctx, tt.args.req)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
require.Error(ttt, err)
|
assert.Error(ttt, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
require.NoError(ttt, err)
|
if !assert.NoError(ttt, err) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
tt.want.User.UserId = tt.args.req.GetUserId()
|
tt.want.User.UserId = tt.args.req.GetUserId()
|
||||||
tt.want.User.Username = newOrgOwnerEmail
|
tt.want.User.Username = newOrgOwnerEmail
|
||||||
tt.want.User.PreferredLoginName = newOrgOwnerEmail
|
tt.want.User.PreferredLoginName = newOrgOwnerEmail
|
||||||
@ -923,27 +928,27 @@ func TestServer_ListUsers(t *testing.T) {
|
|||||||
// always only give back dependency infos which are required for the response
|
// always only give back dependency infos which are required for the response
|
||||||
require.Len(ttt, tt.want.Result, len(infos))
|
require.Len(ttt, tt.want.Result, len(infos))
|
||||||
// always first check length, otherwise its failed anyway
|
// always first check length, otherwise its failed anyway
|
||||||
require.Len(ttt, got.Result, len(tt.want.Result))
|
if assert.Len(ttt, got.Result, len(tt.want.Result)) {
|
||||||
// fill in userid and username as it is generated
|
// totalResult is unrelated to the tests here so gets carried over, can vary from the count of results due to permissions
|
||||||
|
tt.want.Details.TotalResult = got.Details.TotalResult
|
||||||
|
|
||||||
// totalResult is unrelated to the tests here so gets carried over, can vary from the count of results due to permissions
|
// fill in userid and username as it is generated
|
||||||
tt.want.Details.TotalResult = got.Details.TotalResult
|
for i := range infos {
|
||||||
|
tt.want.Result[i].UserId = infos[i].UserID
|
||||||
for i := range infos {
|
tt.want.Result[i].Username = infos[i].Username
|
||||||
tt.want.Result[i].UserId = infos[i].UserID
|
tt.want.Result[i].PreferredLoginName = infos[i].Username
|
||||||
tt.want.Result[i].Username = infos[i].Username
|
tt.want.Result[i].LoginNames = []string{infos[i].Username}
|
||||||
tt.want.Result[i].PreferredLoginName = infos[i].Username
|
if human := tt.want.Result[i].GetHuman(); human != nil {
|
||||||
tt.want.Result[i].LoginNames = []string{infos[i].Username}
|
human.Email.Email = infos[i].Username
|
||||||
if human := tt.want.Result[i].GetHuman(); human != nil {
|
if tt.want.Result[i].GetHuman().GetPasswordChanged() != nil {
|
||||||
human.Email.Email = infos[i].Username
|
human.PasswordChanged = infos[i].Changed
|
||||||
if tt.want.Result[i].GetHuman().GetPasswordChanged() != nil {
|
}
|
||||||
human.PasswordChanged = infos[i].Changed
|
|
||||||
}
|
}
|
||||||
|
tt.want.Result[i].Details = detailsV2ToV2beta(infos[i].Details)
|
||||||
|
}
|
||||||
|
for i := range tt.want.Result {
|
||||||
|
assert.Contains(ttt, got.Result, tt.want.Result[i])
|
||||||
}
|
}
|
||||||
tt.want.Result[i].Details = detailsV2ToV2beta(infos[i].Details)
|
|
||||||
}
|
|
||||||
for i := range tt.want.Result {
|
|
||||||
assert.Contains(ttt, got.Result, tt.want.Result[i])
|
|
||||||
}
|
}
|
||||||
integration.AssertListDetails(ttt, tt.want, got)
|
integration.AssertListDetails(ttt, tt.want, got)
|
||||||
}, retryDuration, tick, "timeout waiting for expected user result")
|
}, retryDuration, tick, "timeout waiting for expected user result")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user