Search in sources :

Example 26 with Resources

use of org.bf2.cos.fleetshard.support.resources.Resources 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

Test (org.junit.jupiter.api.Test)10 Secret (io.fabric8.kubernetes.api.model.Secret)6 File (java.io.File)6 ManagedKafka (org.bf2.operator.resources.v1alpha1.ManagedKafka)6 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)4 ObjectMetaBuilder (io.fabric8.kubernetes.api.model.ObjectMetaBuilder)4 MeterRegistry (io.micrometer.core.instrument.MeterRegistry)4 List (java.util.List)4 NamespaceBuilder (io.fabric8.kubernetes.api.model.NamespaceBuilder)3 Quantity (io.fabric8.kubernetes.api.model.Quantity)3 SecretBuilder (io.fabric8.kubernetes.api.model.SecretBuilder)3 KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 ConnectorDeployment (org.bf2.cos.fleet.manager.model.ConnectorDeployment)3 ManagedConnector (org.bf2.cos.fleetshard.api.ManagedConnector)3 ManagedConnectorBuilder (org.bf2.cos.fleetshard.api.ManagedConnectorBuilder)3 FleetShardSyncConfig (org.bf2.cos.fleetshard.sync.FleetShardSyncConfig)3 FleetManagerClient (org.bf2.cos.fleetshard.sync.client.FleetManagerClient)3 FleetShardClient (org.bf2.cos.fleetshard.sync.client.FleetShardClient)3