use of org.bf2.cos.fleet.manager.model.ConnectorNamespaceTenant in project cos-fleetshard by bf2fc6cc711aee1a0c2a.
the class NamespaceProvisionerTest method nameIsSanitized.
@Test
void nameIsSanitized() {
//
// Given that no resources associated to the provided deployment exist
//
final ConnectorNamespace namespace = new ConnectorNamespace();
namespace.id(uid());
namespace.name("--eval");
ConnectorNamespaceTenant tenant = new ConnectorNamespaceTenant().id(uid()).kind(ConnectorNamespaceTenantKind.ORGANISATION);
namespace.setStatus(new ConnectorNamespaceStatus1().state(ConnectorNamespaceState.READY).connectorsDeployed(0));
namespace.setTenant(tenant);
namespace.setExpiration(new Date().toString());
final List<ManagedConnector> connectors = List.of();
final List<Secret> secrets = List.of();
final FleetShardClient fleetShard = ConnectorTestSupport.fleetShard(CLUSTER_ID, connectors, secrets);
final FleetManagerClient fleetManager = ConnectorTestSupport.fleetManagerClient();
final FleetShardSyncConfig config = ConnectorTestSupport.config();
final MeterRegistry registry = Mockito.mock(MeterRegistry.class);
final ConnectorNamespaceProvisioner provisioner = new ConnectorNamespaceProvisioner(config, fleetShard, fleetManager, registry);
final ArgumentCaptor<Namespace> nc = ArgumentCaptor.forClass(Namespace.class);
//
// When deployment is applied
//
provisioner.provision(namespace);
verify(fleetShard).createNamespace(nc.capture());
//
// Then resources must be created according to the deployment
//
assertThat(nc.getValue()).satisfies(val -> {
assertThat(val.getMetadata().getLabels()).containsEntry(LABEL_KUBERNETES_NAME, "a--eval");
});
}
use of org.bf2.cos.fleet.manager.model.ConnectorNamespaceTenant in project cos-fleetshard by bf2fc6cc711aee1a0c2a.
the class SyncTestSupport method namespace.
public static ConnectorNamespace namespace(String id, String name) {
ConnectorNamespace answer = new ConnectorNamespace().id(id).name(name);
ConnectorNamespaceTenant tenant = new ConnectorNamespaceTenant().id(uid()).kind(ConnectorNamespaceTenantKind.ORGANISATION);
answer.setStatus(new ConnectorNamespaceStatus1().state(ConnectorNamespaceState.READY).connectorsDeployed(0));
answer.setTenant(tenant);
answer.setExpiration(new Date().toString());
return answer;
}
Aggregations