aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgvit <gvit@ydb.tech>2023-01-23 00:40:11 +0300
committergvit <gvit@ydb.tech>2023-01-23 00:40:11 +0300
commitbdf6b3d837866fbc295d59139b5aa08807d7611c (patch)
tree50cb2dd22a0442d9efa3face877dc3f5c810db21
parent774dc92d50dd742e6bdfb3776096800ef6112fa3 (diff)
downloadydb-bdf6b3d837866fbc295d59139b5aa08807d7611c.tar.gz
remove quota tests: we don't allocate compute resources via tenant slot broker
-rw-r--r--ydb/core/cms/console/console_ut_tenants.cpp293
1 files changed, 0 insertions, 293 deletions
diff --git a/ydb/core/cms/console/console_ut_tenants.cpp b/ydb/core/cms/console/console_ut_tenants.cpp
index 20889e6961..c8c0259536 100644
--- a/ydb/core/cms/console/console_ut_tenants.cpp
+++ b/ydb/core/cms/console/console_ut_tenants.cpp
@@ -90,37 +90,6 @@ TTenantTestConfig DefaultConsoleTestConfig()
return res;
}
-TTenantTestConfig ConsoleTestConfig3DC()
-{
- TTenantTestConfig res = {
- // Domains {name, schemeshard {{ subdomain_names }}}
- {{ {DOMAIN1_NAME, SCHEME_SHARD1_ID, TVector<TString>()} }},
- // HiveId
- HIVE_ID,
- // FakeTenantSlotBroker
- false,
- // FakeSchemeShard
- false,
- // CreateConsole
- true,
- // Nodes {tenant_pool_config, data_center}
- {{
- {DefaultTenantPoolConfig()},
- {DefaultTenantPoolConfig()},
- {DefaultTenantPoolConfig()},
- {DefaultTenantPoolConfig()},
- {DefaultTenantPoolConfig()},
- {DefaultTenantPoolConfig()},
- {DefaultTenantPoolConfig()},
- {DefaultTenantPoolConfig()},
- {DefaultTenantPoolConfig()},
- }},
- // DataCenterCount
- 3
- };
- return res;
-}
-
void CheckAlterTenantSlots(TTenantTestRuntime &runtime, const TString &path,
ui64 generation, Ydb::StatusIds::StatusCode code,
TVector<TSlotRequest> add,
@@ -2063,268 +2032,6 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
RunTestRemoveAttributes(runtime);
}
- Y_UNIT_TEST(TestTenantsQuota) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig());
-
- // Set tenants quota to 2.
- NKikimrConsole::TConfig config = GetCurrentConfig(runtime);
- auto &quota = *config.MutableTenantsConfig()->MutableClusterQuota();
- quota.SetTenantsQuota(2);
- CheckSetConfig(runtime, config, Ydb::StatusIds::SUCCESS);
-
- // Create first tenant.
- CheckCreateTenant(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
- {{"hdd", 1}},
- SLOT1_TYPE, ZONE1, 1);
- // Wrong request shouldn't eat quota.
- CheckCreateTenant(runtime, Ydb::StatusIds::BAD_REQUEST, TCreateTenantRequest(""));
- // This one should fail on subdomain creation and then release quota.
- CheckCreateTenant(runtime, Ydb::StatusIds::GENERIC_ERROR,
- TCreateTenantRequest(TENANT1_1_NAME + "/sub").WithPools({{"hdd", 1}}));
- // Here status is received before tenant is completely removed.
- // Wait for complete removal.
- WaitForTenantStatus(runtime, TENANT1_1_NAME + "/sub", Ydb::StatusIds::NOT_FOUND);
- // Create second tenant.
- CheckCreateTenant(runtime, TENANT1_2_NAME, Ydb::StatusIds::SUCCESS,
- {{"hdd", 1}},
- SLOT1_TYPE, ZONE1, 1);
- // Quota is exceeded.
- CheckCreateTenant(runtime, TENANT1_3_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{"hdd", 1}},
- SLOT1_TYPE, ZONE1, 1);
- // Remove tenant to get some free quota.
- WaitTenantRunning(runtime, TENANT1_2_NAME); // workaround for scheme cache race
- CheckRemoveTenant(runtime, TENANT1_2_NAME, Ydb::StatusIds::SUCCESS);
- // Create second tenant.
- CheckCreateTenant(runtime, TENANT1_3_NAME, Ydb::StatusIds::SUCCESS,
- {{"hdd", 1}},
- SLOT1_TYPE, ZONE1, 1);
- // Quota is exceeded again.
- CheckCreateTenant(runtime, TENANT1_2_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{"hdd", 1}},
- SLOT1_TYPE, ZONE1, 1);
- // Increase quota.
- quota.SetTenantsQuota(3);
- CheckSetConfig(runtime, config, Ydb::StatusIds::SUCCESS);
- // Now we can create third tenant.
- CheckCreateTenant(runtime, TENANT1_2_NAME, Ydb::StatusIds::SUCCESS,
- {{"hdd", 1}},
- SLOT1_TYPE, ZONE1, 1);
-
- CheckCounter(runtime, {}, TTenantsManager::COUNTER_TENANTS_QUOTA_EXCEEDED, 2);
- }
-
- Y_UNIT_TEST(TestComputationalUnitsQuota) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig());
-
- // Set tenants quota to 2.
- NKikimrConsole::TConfig config = GetCurrentConfig(runtime);
- auto &quota = *config.MutableTenantsConfig()->MutableClusterQuota();
- quota.SetComputationalUnitsQuota(10);
- CheckSetConfig(runtime, config, Ydb::StatusIds::SUCCESS);
-
- // OK.
- CheckCreateTenant(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
- {{"hdd", 1}},
- SLOT3_TYPE, ZONE_ANY, 5);
- CheckTenantStatus(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
- Ydb::Cms::GetDatabaseStatusResult::RUNNING,
- {{"hdd", 1, 1}}, {},
- SLOT3_TYPE, ZONE_ANY, 5, 5);
- // Wrong request shouldn't eat quota.
- CheckCreateTenant(runtime, "", Ydb::StatusIds::BAD_REQUEST,
- {{"hdd", 1}},
- SLOT2_TYPE, ZONE_ANY, 5);
- // This one should fail on subdomain creation and then release quota.
- CheckCreateTenant(runtime, TENANT1_1_NAME + "/sub", Ydb::StatusIds::GENERIC_ERROR,
- {{"hdd", 1}},
- SLOT2_TYPE, ZONE_ANY, 5);
- // Wait for complete tenant removal.
- WaitForTenantStatus(runtime, TENANT1_1_NAME + "/sub", Ydb::StatusIds::NOT_FOUND);
- CheckTenantStatus(runtime, TENANT1_1_NAME + "/sub", Ydb::StatusIds::NOT_FOUND,
- Ydb::Cms::GetDatabaseStatusResult::STATE_UNSPECIFIED, {}, {});
- // OK.
- CheckCreateTenant(runtime, TENANT1_2_NAME, Ydb::StatusIds::SUCCESS,
- {{"hdd", 1}},
- SLOT2_TYPE, ZONE_ANY, 5);
- CheckTenantStatus(runtime, TENANT1_2_NAME, Ydb::StatusIds::SUCCESS,
- Ydb::Cms::GetDatabaseStatusResult::RUNNING,
- {{"hdd", 1, 1}}, {},
- SLOT2_TYPE, ZONE_ANY, 5, 5);
- // Out of quota.
- CheckCreateTenant(runtime, TENANT1_3_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{"hdd", 1}},
- SLOT3_TYPE, ZONE_ANY, 5);
- // Out of quota.
- CheckAlterTenantSlots(runtime, TENANT1_1_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{ {SLOT3_TYPE, ZONE_ANY, 1} }},
- {});
- // OK to add if some slots are removed.
- CheckAlterTenantSlots(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
- {{ {SLOT2_TYPE, ZONE_ANY, 2} }},
- {{ {SLOT3_TYPE, ZONE_ANY, 3} }});
- // Out of quota.
- CheckAlterTenantSlots(runtime, TENANT1_2_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{ {SLOT3_TYPE, ZONE_ANY, 2} }},
- {});
- // OK.
- CheckAlterTenantSlots(runtime, TENANT1_2_NAME, Ydb::StatusIds::SUCCESS,
- {{ {SLOT3_TYPE, ZONE_ANY, 1} }},
- {});
- CheckTenantStatus(runtime, TENANT1_2_NAME, Ydb::StatusIds::SUCCESS,
- Ydb::Cms::GetDatabaseStatusResult::RUNNING,
- {{"hdd", 1, 1}}, {},
- SLOT2_TYPE, ZONE_ANY, 5, 5,
- SLOT3_TYPE, ZONE_ANY, 1, 1);
- // Remove tenant to release some resources.
- CheckRemoveTenant(runtime, TENANT1_2_NAME, Ydb::StatusIds::SUCCESS);
- CheckTenantStatus(runtime, TENANT1_2_NAME, Ydb::StatusIds::NOT_FOUND,
- Ydb::Cms::GetDatabaseStatusResult::STATE_UNSPECIFIED, {}, {});
- // OK.
- CheckCreateTenant(runtime, TENANT1_3_NAME, Ydb::StatusIds::SUCCESS,
- {{"hdd", 1}},
- SLOT2_TYPE, ZONE_ANY, 6);
- CheckTenantStatus(runtime, TENANT1_3_NAME, Ydb::StatusIds::SUCCESS,
- Ydb::Cms::GetDatabaseStatusResult::RUNNING,
- {{"hdd", 1, 1}}, {},
- SLOT2_TYPE, ZONE_ANY, 6, 6);
- // Out of quota.
- CheckAlterTenantSlots(runtime, TENANT1_1_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{ {SLOT3_TYPE, ZONE_ANY, 1} }},
- {});
-
- CheckCounter(runtime, {}, TTenantsManager::COUNTER_COMPUTATIONAL_QUOTA_EXCEEDED, 4);
-
- // Check quota is correctly computed after Console restart.
- RestartConsole(runtime);
-
- // Out of quota.
- CheckAlterTenantSlots(runtime, TENANT1_1_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{ {SLOT3_TYPE, ZONE_ANY, 1} }},
- {});
- // OK to change slot type.
- CheckAlterTenantSlots(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
- {{ {SLOT2_TYPE, ZONE_ANY, 1} }},
- {{ {SLOT3_TYPE, ZONE_ANY, 1} }});
- }
-
- Y_UNIT_TEST(TestComputationalUnitsLoadQuota) {
- TTenantTestRuntime runtime(ConsoleTestConfig3DC());
-
- // Set tenants quota to 2.
- NKikimrConsole::TConfig config = GetCurrentConfig(runtime);
- auto &quota = *config.MutableTenantsConfig()->MutableClusterQuota();
- quota.SetComputationalUnitsLoadQuota(67);
- auto anyUnit = config.MutableTenantsConfig()->AddComputationalUnitKinds();
- anyUnit->SetKind("any");
- anyUnit->SetTenantSlotType("");
- anyUnit->SetAvailabilityZoneSet("all");
- CheckSetConfig(runtime, config, Ydb::StatusIds::SUCCESS);
-
- // OK.
- CheckCreateTenant(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
- {{"hdd", 1}},
- SLOT2_TYPE, ZONE_ANY, 5);
- CheckTenantStatus(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
- Ydb::Cms::GetDatabaseStatusResult::RUNNING,
- {{"hdd", 1, 1}}, {},
- SLOT2_TYPE, ZONE_ANY, 5, 5);
- // Out of quota for SLOT2_TYPE.
- CheckCreateTenant(runtime, TENANT1_2_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{"hdd", 1}},
- SLOT2_TYPE, ZONE1, 2);
- // OK.
- CheckCreateTenant(runtime, TENANT1_2_NAME, Ydb::StatusIds::SUCCESS,
- {{"hdd", 1}},
- SLOT2_TYPE, ZONE1, 1);
- CheckTenantStatus(runtime, TENANT1_2_NAME, Ydb::StatusIds::SUCCESS,
- Ydb::Cms::GetDatabaseStatusResult::RUNNING,
- {{"hdd", 1, 1}}, {},
- SLOT2_TYPE, ZONE1, 1, 1);
- // Out of total quota.
- CheckCreateTenant(runtime, TENANT1_3_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{"hdd", 1}},
- "any", ZONE_ANY, 13);
- // OK.
- CheckCreateTenant(runtime, TENANT1_3_NAME, Ydb::StatusIds::SUCCESS,
- {{"hdd", 1}},
- "any", ZONE_ANY, 12);
- CheckTenantStatus(runtime, TENANT1_3_NAME, Ydb::StatusIds::SUCCESS,
- Ydb::Cms::GetDatabaseStatusResult::RUNNING,
- {{"hdd", 1, 1}}, {},
- "any", ZONE_ANY, 12, 12);
-
- CheckCounter(runtime, {{ {"kind", SLOT2_TYPE}, {"zone", ZONE_ANY } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 5);
- CheckCounter(runtime, {{ {"kind", SLOT2_TYPE}, {"zone", ZONE1 } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 1);
- CheckCounter(runtime, {{ {"kind", "any"}, {"zone", ZONE_ANY } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 12);
-
- // Out of total quota.
- CheckAlterTenantSlots(runtime, TENANT1_1_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{ {"any", ZONE_ANY, 1} }},
- {});
- // OK to change TYPE2_SLOT to another type.
- CheckAlterTenantSlots(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
- {{ {"any", ZONE_ANY, 1} }},
- {{ {SLOT2_TYPE, ZONE_ANY, 1} }});
- // Out of SLOT2_TYPE quota.
- CheckAlterTenantSlots(runtime, TENANT1_3_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{ {SLOT2_TYPE, ZONE_ANY, 2} }},
- {{ {"any", ZONE_ANY, 2} }});
- // OK.
- CheckAlterTenantSlots(runtime, TENANT1_3_NAME, Ydb::StatusIds::SUCCESS,
- {{ {SLOT2_TYPE, ZONE_ANY, 1} }},
- {{ {"any", ZONE_ANY, 1} }});
- CheckTenantStatus(runtime, TENANT1_3_NAME, Ydb::StatusIds::SUCCESS,
- Ydb::Cms::GetDatabaseStatusResult::RUNNING,
- {{"hdd", 1, 1}}, {},
- "any", ZONE_ANY, 11, 11,
- SLOT2_TYPE, ZONE_ANY, 1, 1);
-
- CheckCounter(runtime, {{ {"kind", SLOT2_TYPE}, {"zone", ZONE_ANY } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 5);
- CheckCounter(runtime, {{ {"kind", SLOT2_TYPE}, {"zone", ZONE1 } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 1);
- CheckCounter(runtime, {{ {"kind", "any"}, {"zone", ZONE_ANY } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 12);
-
- // Remove tenant to release some resources.
- CheckRemoveTenant(runtime, TENANT1_3_NAME, Ydb::StatusIds::SUCCESS);
- CheckTenantStatus(runtime, TENANT1_3_NAME, Ydb::StatusIds::NOT_FOUND,
- Ydb::Cms::GetDatabaseStatusResult::STATE_UNSPECIFIED, {}, {});
-
- CheckCounter(runtime, {{ {"kind", SLOT2_TYPE}, {"zone", ZONE_ANY } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 4);
- CheckCounter(runtime, {{ {"kind", SLOT2_TYPE}, {"zone", ZONE1 } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 1);
- CheckCounter(runtime, {{ {"kind", "any"}, {"zone", ZONE_ANY } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 1);
-
- // Out of SLOT2_TYPE quota.
- CheckAlterTenantSlots(runtime, TENANT1_2_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{ {SLOT2_TYPE, ZONE_ANY, 2} }},
- {});
- // Out of total quota.
- CheckAlterTenantSlots(runtime, TENANT1_2_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{ {SLOT2_TYPE, ZONE_ANY, 1},
- {"any", ZONE_ANY, 12} }},
- {});
- // OK
- CheckAlterTenantSlots(runtime, TENANT1_2_NAME, Ydb::StatusIds::SUCCESS,
- {{ {SLOT2_TYPE, ZONE_ANY, 1},
- {"any", ZONE_ANY, 11} }},
- {});
-
- CheckCounter(runtime, {{ {"kind", SLOT2_TYPE}, {"zone", ZONE_ANY } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 5);
- CheckCounter(runtime, {{ {"kind", SLOT2_TYPE}, {"zone", ZONE1 } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 1);
- CheckCounter(runtime, {{ {"kind", "any"}, {"zone", ZONE_ANY } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 12);
-
- // Check quota is correctly computed after Console restart.
- RestartConsole(runtime);
-
- // Out of quota.
- CheckAlterTenantSlots(runtime, TENANT1_2_NAME, Ydb::StatusIds::UNAVAILABLE,
- {{ {"any", ZONE_ANY, 1} }},
- {});
-
- CheckCounter(runtime, {{ {"kind", SLOT2_TYPE}, {"zone", ZONE_ANY } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 5);
- CheckCounter(runtime, {{ {"kind", SLOT2_TYPE}, {"zone", ZONE1 } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 1);
- CheckCounter(runtime, {{ {"kind", "any"}, {"zone", ZONE_ANY } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 12);
- }
-
void RunTestTenantGeneration(TTenantTestRuntime& runtime) {
CheckCreateTenant(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
{{"hdd", 1}},