mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 01:42:37 +08:00
add TENANT_LIST to existing tests
This commit is contained in:
parent
c683795f6b
commit
c0aa361885
@ -483,6 +483,14 @@ public class AsyncStackTester {
|
|||||||
inst.push(TenantManagement.deleteTenant(inst.context.db, tenantName));
|
inst.push(TenantManagement.deleteTenant(inst.context.db, tenantName));
|
||||||
}, FDB.DEFAULT_EXECUTOR);
|
}, FDB.DEFAULT_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
else if (op == StackOperation.TENANT_LIST) {
|
||||||
|
return inst.popParams(3).thenAcceptAsync(params -> {
|
||||||
|
byte[] begin = (byte[])params.get(0);
|
||||||
|
byte[] end = (byte[])params.get(1);
|
||||||
|
int limit = StackUtils.getInt(params.get(2));
|
||||||
|
inst.push(TenantManagement.listTenants(inst.context.db, begin, end, limit));
|
||||||
|
}, FDB.DEFAULT_EXECUTOR);
|
||||||
|
}
|
||||||
else if (op == StackOperation.TENANT_SET_ACTIVE) {
|
else if (op == StackOperation.TENANT_SET_ACTIVE) {
|
||||||
return inst.popParam().thenAcceptAsync(param -> {
|
return inst.popParam().thenAcceptAsync(param -> {
|
||||||
byte[] tenantName = (byte[])param;
|
byte[] tenantName = (byte[])param;
|
||||||
|
@ -76,6 +76,7 @@ enum StackOperation {
|
|||||||
// Tenants
|
// Tenants
|
||||||
TENANT_CREATE,
|
TENANT_CREATE,
|
||||||
TENANT_DELETE,
|
TENANT_DELETE,
|
||||||
|
TENANT_LIST,
|
||||||
TENANT_SET_ACTIVE,
|
TENANT_SET_ACTIVE,
|
||||||
TENANT_CLEAR_ACTIVE,
|
TENANT_CLEAR_ACTIVE,
|
||||||
|
|
||||||
|
@ -429,6 +429,13 @@ public class StackTester {
|
|||||||
byte[] tenantName = (byte[])inst.popParam().join();
|
byte[] tenantName = (byte[])inst.popParam().join();
|
||||||
inst.push(TenantManagement.deleteTenant(inst.context.db, tenantName));
|
inst.push(TenantManagement.deleteTenant(inst.context.db, tenantName));
|
||||||
}
|
}
|
||||||
|
else if (op == StackOperation.TENANT_LIST) {
|
||||||
|
List<Object> params = inst.popParams(3).join();
|
||||||
|
byte[] begin = (byte[])params.get(0);
|
||||||
|
byte[] end = (byte[])params.get(1);
|
||||||
|
int limit = StackUtils.getInt(params.get(2));
|
||||||
|
inst.push(TenantManagement.listTenants(inst.context.db, begin, end, limit));
|
||||||
|
}
|
||||||
else if (op == StackOperation.TENANT_SET_ACTIVE) {
|
else if (op == StackOperation.TENANT_SET_ACTIVE) {
|
||||||
byte[] tenantName = (byte[])inst.popParam().join();
|
byte[] tenantName = (byte[])inst.popParam().join();
|
||||||
inst.context.setTenant(Optional.of(tenantName));
|
inst.context.setTenant(Optional.of(tenantName));
|
||||||
|
@ -59,6 +59,10 @@ def test_tenant_operations(db):
|
|||||||
fdb.tenant_management.create_tenant(db, b'tenant1')
|
fdb.tenant_management.create_tenant(db, b'tenant1')
|
||||||
fdb.tenant_management.create_tenant(db, b'tenant2')
|
fdb.tenant_management.create_tenant(db, b'tenant2')
|
||||||
|
|
||||||
|
tenant_list = fdb.tenant_management.list_tenants(db, b'a', b'z', 10).to_list()
|
||||||
|
assert tenant_list[0] == b'tenant1'
|
||||||
|
assert tenant_list[1] == b'tenant2'
|
||||||
|
|
||||||
tenant1 = db.open_tenant(b'tenant1')
|
tenant1 = db.open_tenant(b'tenant1')
|
||||||
tenant2 = db.open_tenant(b'tenant2')
|
tenant2 = db.open_tenant(b'tenant2')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user