GH-15742: added db health check method in app (#15752)
Этот коммит содержится в:
@@ -473,3 +473,27 @@ func TestDoEmojisPermissionsMigration(t *testing.T) {
|
||||
sort.Strings(systemAdmin2.Permissions)
|
||||
assert.Equal(t, expectedSystemAdmin, systemAdmin2.Permissions, fmt.Sprintf("'%v' did not have expected permissions", model.SYSTEM_ADMIN_ROLE_ID))
|
||||
}
|
||||
|
||||
func TestDBHealthCheckWriteAndDelete(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
expectedKey := "health_check_" + th.App.GetClusterId()
|
||||
assert.Equal(t, expectedKey, th.App.dbHealthCheckKey())
|
||||
|
||||
_, err := th.App.Srv().Store.System().GetByName(expectedKey)
|
||||
assert.NotNil(t, err)
|
||||
|
||||
err = th.App.DBHealthCheckWrite()
|
||||
assert.Nil(t, err)
|
||||
|
||||
systemVal, err := th.App.Srv().Store.System().GetByName(expectedKey)
|
||||
assert.Nil(t, err)
|
||||
assert.NotNil(t, systemVal)
|
||||
|
||||
err = th.App.DBHealthCheckDelete()
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, err = th.App.Srv().Store.System().GetByName(expectedKey)
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user