mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 05:52:51 +00:00
test: fix matrix for relation table tests (#11757)
# Which Problems Are Solved In #11239 , the helper function for matrix tests (without the relational tables enabled) was changed, but the feature was never enabled in the matrix. Some integration tests currently can't even succeed because of missing implementations. # How the Problems Are Solved This PR correctly enables the feature where intended and returns the state into the matrix. This allows returning early for some tests which cannot succeed yet. Corresponding todos have been re-added as well. # Additional Changes None # Additional Context - relates to #11239 - requires backport to v4.x
This commit is contained in:
@@ -372,18 +372,21 @@ func TestServer_UpdateOrganization(t *testing.T) {
|
||||
|
||||
tt.Run("unhappy: no permission", func(ttt *testing.T) {
|
||||
// given
|
||||
organisation, orgName, _ := createOrg(sysAuthZ, ttt, client)
|
||||
organisation, _, _ := createOrg(sysAuthZ, ttt, client)
|
||||
|
||||
// when
|
||||
_, err := client.UpdateOrganization(
|
||||
inst.WithAuthorizationToken(ctx, integration.UserTypeOrgOwner),
|
||||
&v2beta_org.UpdateOrganizationRequest{
|
||||
Id: organisation.Id,
|
||||
Name: orgName,
|
||||
Name: integration.OrganizationName(),
|
||||
},
|
||||
)
|
||||
|
||||
// then
|
||||
if relTableCase.Enabled {
|
||||
ttt.Skip("TODO: remove when permission model is implemented in relational tables")
|
||||
}
|
||||
assert.Error(ttt, err)
|
||||
})
|
||||
})
|
||||
@@ -738,6 +741,9 @@ func TestServer_DeleteOrganization(t *testing.T) {
|
||||
_, err := client.DeleteOrganization(u, &v2beta_org.DeleteOrganizationRequest{Id: organisation.Id})
|
||||
|
||||
// then
|
||||
if relTableTestCase.Enabled {
|
||||
tttt.Skip("TODO: remove when permission model is implemented in relational tables")
|
||||
}
|
||||
assert.ErrorContains(tttt, err, "membership not found")
|
||||
})
|
||||
}
|
||||
@@ -833,6 +839,9 @@ func TestServer_ActivateOrganization(t *testing.T) {
|
||||
_, err = client.ActivateOrganization(u, &v2beta_org.ActivateOrganizationRequest{Id: organisation.Id})
|
||||
|
||||
// then
|
||||
if testCase.Enabled {
|
||||
tttt.Skip("TODO: remove when permission model is implemented in relational tables")
|
||||
}
|
||||
assert.ErrorContains(tttt, err, "membership not found")
|
||||
})
|
||||
}
|
||||
@@ -903,6 +912,9 @@ func TestServer_DeactivateOrganization(t *testing.T) {
|
||||
_, err := client.DeactivateOrganization(u, &v2beta_org.DeactivateOrganizationRequest{Id: organisation.Id})
|
||||
|
||||
// then
|
||||
if testCase.Enabled {
|
||||
tttt.Skip("TODO: remove when permission model is implemented in relational tables")
|
||||
}
|
||||
assert.ErrorContains(tttt, err, "membership not found")
|
||||
})
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ type RelationalTableFeatureMatrix struct {
|
||||
Name string
|
||||
Inst *Instance
|
||||
InstOwner context.Context
|
||||
Enabled bool
|
||||
}
|
||||
|
||||
// TODO(IAM-Marco): Once we have gotten rid of eventstore, this can be removed
|
||||
@@ -51,12 +52,16 @@ func RelationalTablesEnableMatrix(t *testing.T, ctx context.Context, sysAuthZ co
|
||||
func() RelationalTableFeatureMatrix {
|
||||
inst := NewInstance(sysAuthZ)
|
||||
instOwner := inst.WithAuthorizationToken(ctx, UserTypeIAMOwner)
|
||||
_, err := inst.Client.FeatureV2.SetInstanceFeatures(instOwner, &feature.SetInstanceFeaturesRequest{EnableRelationalTables: gu.Ptr(false)})
|
||||
require.NoError(t, err)
|
||||
EnsureInstanceFeature(t, ctx, inst, &feature.SetInstanceFeaturesRequest{
|
||||
EnableRelationalTables: gu.Ptr(true),
|
||||
}, func(tt *assert.CollectT, got *feature.GetInstanceFeaturesResponse) {
|
||||
assert.True(tt, got.GetEnableRelationalTables().GetEnabled(), "expected relational tables to be enabled")
|
||||
})
|
||||
return RelationalTableFeatureMatrix{
|
||||
Name: "when relational tables are enabled",
|
||||
Inst: inst,
|
||||
InstOwner: instOwner,
|
||||
Enabled: true,
|
||||
}
|
||||
}(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user