Search in sources :

Example 1 with RegistryDeploymentCreateRest

use of org.bf2.srs.fleetmanager.rest.privateapi.beans.RegistryDeploymentCreateRest in project srs-fleet-manager by bf2fc6cc711aee1a0c2a.

the class RegistryProvisioningIT method testProvisionRegistry.

@Test
void testProvisionRegistry() {
    FleetManagerApi.verifyApiIsSecured();
    var alice = new AccountInfo("testProvisionRegistry", "alice", false, 10L);
    // verify static deployments config file feature
    var deployment = new RegistryDeploymentCreateRest();
    deployment.setName("test-deployment");
    deployment.setTenantManagerUrl(infra.getTenantManagerUri());
    deployment.setRegistryDeploymentUrl("http://registry-test");
    FleetManagerApi.verifyCreateDeploymentNotAllowed(deployment, alice);
    var registry1 = new RegistryCreate();
    registry1.setName("test-registry-1");
    var registry1Result = FleetManagerApi.createRegistry(registry1, alice);
    assertNotEquals(RegistryStatusValue.failed, registry1Result.getStatus());
    Awaitility.await("registry available").atMost(30, TimeUnit.SECONDS).pollInterval(5, TimeUnit.SECONDS).until(() -> {
        var reg = FleetManagerApi.getRegistry(registry1Result.getId(), alice);
        return reg.getStatus().equals(RegistryStatusValue.ready);
    });
    Registry registry = FleetManagerApi.getRegistry(registry1Result.getId(), alice);
    TenantManagerClient tenantManager = Utils.createTenantManagerClient();
    var internalTenant = tenantManager.getTenant(registry.getId());
    var resources = internalTenant.getResources();
    TenantResource maxTotalSchemas = null;
    for (var r : resources) {
        if (r.getType() == ResourceType.MAX_TOTAL_SCHEMAS_COUNT) {
            maxTotalSchemas = r;
        }
    }
    assertNotNull(maxTotalSchemas);
    assertEquals(10, maxTotalSchemas.getLimit());
    // TODO e2e test check limits are applied
    // Delete
    FleetManagerApi.deleteRegistry(registry1Result.getId(), alice);
}
Also used : TenantManagerClient(io.apicurio.multitenant.client.TenantManagerClient) RegistryDeploymentCreateRest(org.bf2.srs.fleetmanager.rest.privateapi.beans.RegistryDeploymentCreateRest) TenantResource(io.apicurio.multitenant.api.datamodel.TenantResource) Registry(org.bf2.srs.fleetmanager.rest.publicapi.beans.Registry) RegistryCreate(org.bf2.srs.fleetmanager.rest.publicapi.beans.RegistryCreate) AccountInfo(org.bf2.srs.fleetmanager.spi.common.model.AccountInfo) Test(org.junit.jupiter.api.Test)

Aggregations

TenantResource (io.apicurio.multitenant.api.datamodel.TenantResource)1 TenantManagerClient (io.apicurio.multitenant.client.TenantManagerClient)1 RegistryDeploymentCreateRest (org.bf2.srs.fleetmanager.rest.privateapi.beans.RegistryDeploymentCreateRest)1 Registry (org.bf2.srs.fleetmanager.rest.publicapi.beans.Registry)1 RegistryCreate (org.bf2.srs.fleetmanager.rest.publicapi.beans.RegistryCreate)1 AccountInfo (org.bf2.srs.fleetmanager.spi.common.model.AccountInfo)1 Test (org.junit.jupiter.api.Test)1