Reject mysql for enterprise advanced (#31164)
* reject MySQL with the enterprise advanced license If a user attempts to set an Enterprise Advanced License while configured with MySQL, reject the license. This SKU is not compatible with MYSQL. * fix trial typo * suppress trial banner if MySQL * Update server/channels/app/platform/license_test.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix types * suppress mysql from show start trial modal * Skip MySQL-incompatible tests for access control and channel banner features Skip the following tests when running with MySQL database: - Access control policy tests (create, get, delete, check/test expressions, search, assign/unassign, get channels) - Channel banner tests in TestPatchChannel and TestCanEditChannelBanner These features are not supported on MySQL and the tests would fail. Tests will continue to run normally on PostgreSQL. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Skip TestSearchChannelsForAccessControlPolicy subtest for MySQL Add MySQL skip logic to the "SearchChannelsForAccessControlPolicy with regular user" subtest as this access control feature is not supported on MySQL. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * reject trial license requests for MySQL * return false on sku + mysql match, even if logger is nil * Fix MySQL trial license tests to skip appropriately based on database driver 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f2bb82bc01
Коммит
70a42ffd5f
@@ -22,6 +22,10 @@ func TestCreateAccessControlPolicy(t *testing.T) {
|
||||
os.Unsetenv("MM_FEATUREFLAGS_ATTRIBUTEBASEDACCESSCONTROL")
|
||||
})
|
||||
|
||||
if *mainHelper.GetSQLSettings().DriverName == model.DatabaseDriverMysql {
|
||||
t.Skip("Access control tests are not supported on MySQL")
|
||||
}
|
||||
|
||||
samplePolicy := &model.AccessControlPolicy{
|
||||
Type: model.AccessControlPolicyTypeChannel,
|
||||
Version: model.AccessControlPolicyVersionV0_1,
|
||||
@@ -89,6 +93,10 @@ func TestGetAccessControlPolicy(t *testing.T) {
|
||||
os.Unsetenv("MM_FEATUREFLAGS_ATTRIBUTEBASEDACCESSCONTROL")
|
||||
})
|
||||
|
||||
if *mainHelper.GetSQLSettings().DriverName == model.DatabaseDriverMysql {
|
||||
t.Skip("Access control tests are not supported on MySQL")
|
||||
}
|
||||
|
||||
samplePolicy := &model.AccessControlPolicy{
|
||||
ID: model.NewId(),
|
||||
Type: model.AccessControlPolicyTypeChannel,
|
||||
@@ -152,6 +160,10 @@ func TestDeleteAccessControlPolicy(t *testing.T) {
|
||||
os.Unsetenv("MM_FEATUREFLAGS_ATTRIBUTEBASEDACCESSCONTROL")
|
||||
})
|
||||
|
||||
if *mainHelper.GetSQLSettings().DriverName == model.DatabaseDriverMysql {
|
||||
t.Skip("Access control tests are not supported on MySQL")
|
||||
}
|
||||
|
||||
samplePolicyID := model.NewId()
|
||||
|
||||
t.Run("DeleteAccessControlPolicy without license", func(t *testing.T) {
|
||||
@@ -202,6 +214,10 @@ func TestCheckExpression(t *testing.T) {
|
||||
os.Unsetenv("MM_FEATUREFLAGS_ATTRIBUTEBASEDACCESSCONTROL")
|
||||
})
|
||||
|
||||
if *mainHelper.GetSQLSettings().DriverName == model.DatabaseDriverMysql {
|
||||
t.Skip("Access control tests are not supported on MySQL")
|
||||
}
|
||||
|
||||
t.Run("CheckExpression without license", func(t *testing.T) {
|
||||
_, resp, err := th.SystemAdminClient.CheckExpression(context.Background(), "true")
|
||||
require.Error(t, err)
|
||||
@@ -275,6 +291,10 @@ func TestTestExpression(t *testing.T) {
|
||||
os.Unsetenv("MM_FEATUREFLAGS_ATTRIBUTEBASEDACCESSCONTROL")
|
||||
})
|
||||
|
||||
if *mainHelper.GetSQLSettings().DriverName == model.DatabaseDriverMysql {
|
||||
t.Skip("Access control tests are not supported on MySQL")
|
||||
}
|
||||
|
||||
t.Run("TestExpression without license", func(t *testing.T) {
|
||||
_, resp, err := th.SystemAdminClient.TestExpression(context.Background(), model.QueryExpressionParams{})
|
||||
require.Error(t, err)
|
||||
@@ -327,6 +347,10 @@ func TestSearchAccessControlPolicies(t *testing.T) {
|
||||
os.Unsetenv("MM_FEATUREFLAGS_ATTRIBUTEBASEDACCESSCONTROL")
|
||||
})
|
||||
|
||||
if *mainHelper.GetSQLSettings().DriverName == model.DatabaseDriverMysql {
|
||||
t.Skip("Access control tests are not supported on MySQL")
|
||||
}
|
||||
|
||||
t.Run("SearchAccessControlPolicies without license", func(t *testing.T) {
|
||||
_, resp, err := th.SystemAdminClient.SearchAccessControlPolicies(context.Background(), model.AccessControlPolicySearch{})
|
||||
require.Error(t, err)
|
||||
@@ -381,6 +405,10 @@ func TestAssignAccessPolicy(t *testing.T) {
|
||||
os.Unsetenv("MM_FEATUREFLAGS_ATTRIBUTEBASEDACCESSCONTROL")
|
||||
})
|
||||
|
||||
if *mainHelper.GetSQLSettings().DriverName == model.DatabaseDriverMysql {
|
||||
t.Skip("Access control tests are not supported on MySQL")
|
||||
}
|
||||
|
||||
samplePolicy := &model.AccessControlPolicy{
|
||||
ID: model.NewId(),
|
||||
Type: model.AccessControlPolicyTypeParent,
|
||||
@@ -448,6 +476,10 @@ func TestUnassignAccessPolicy(t *testing.T) {
|
||||
os.Unsetenv("MM_FEATUREFLAGS_ATTRIBUTEBASEDACCESSCONTROL")
|
||||
})
|
||||
|
||||
if *mainHelper.GetSQLSettings().DriverName == model.DatabaseDriverMysql {
|
||||
t.Skip("Access control tests are not supported on MySQL")
|
||||
}
|
||||
|
||||
samplePolicy := &model.AccessControlPolicy{
|
||||
ID: model.NewId(),
|
||||
Type: model.AccessControlPolicyTypeParent,
|
||||
@@ -519,6 +551,10 @@ func TestGetChannelsForAccessControlPolicy(t *testing.T) {
|
||||
os.Unsetenv("MM_FEATUREFLAGS_ATTRIBUTEBASEDACCESSCONTROL")
|
||||
})
|
||||
|
||||
if *mainHelper.GetSQLSettings().DriverName == model.DatabaseDriverMysql {
|
||||
t.Skip("Access control tests are not supported on MySQL")
|
||||
}
|
||||
|
||||
samplePolicy := &model.AccessControlPolicy{
|
||||
ID: model.NewId(),
|
||||
Type: model.AccessControlPolicyTypeParent,
|
||||
@@ -596,6 +632,10 @@ func TestSearchChannelsForAccessControlPolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("SearchChannelsForAccessControlPolicy with regular user", func(t *testing.T) {
|
||||
if *mainHelper.GetSQLSettings().DriverName == model.DatabaseDriverMysql {
|
||||
t.Skip("Access control tests are not supported on MySQL")
|
||||
}
|
||||
|
||||
ok := th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced))
|
||||
require.True(t, ok, "SetLicense should return true")
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user