Search in sources :

Example 1 with OperandOverrideManager

use of org.bf2.operator.managers.OperandOverrideManager in project kas-fleetshard by bf2fc6cc711aee1a0c2a.

the class AdminServerTest method createAdminServerDeployment.

@ParameterizedTest
@CsvSource({ "test-mk-q,     1, true,  false, /expected/adminserver-quarkus.yml", "test-mk-tls-q, 2, true,  true,  /expected/adminserver-tls-quarkus.yml", "test-mk,       3, false, false, /expected/adminserver.yml", "test-mk-tls,   4, false, true,  /expected/adminserver-tls.yml" })
void createAdminServerDeployment(String name, String versionString, boolean quarkusBased, boolean tls, String expectedResource) throws Exception {
    ManagedKafka mk = buildBasicManagedKafka(name, versionString, tls ? new TlsKeyPair() : null);
    OperandOverride override = new OperandOverride();
    override.setImage("quay.io/mk-ci-cd/kafka-admin-api:0.7.0");
    override.setAdditionalProperty("quarkus-based", quarkusBased);
    OperandOverrideManager overrideManager = Mockito.mock(OperandOverrideManager.class);
    Mockito.when(overrideManager.getAdminServerOverride(versionString)).thenReturn(override);
    Mockito.when(overrideManager.getAdminServerImage(versionString)).thenReturn(override.image);
    QuarkusMock.installMockForType(overrideManager, OperandOverrideManager.class);
    Deployment adminServerDeployment = adminServer.deploymentFrom(mk, null);
    server.getClient().apps().deployments().create(adminServerDeployment);
    assertNotNull(server.getClient().apps().deployments().inNamespace(adminServerDeployment.getMetadata().getNamespace()).withName(adminServerDeployment.getMetadata().getName()).get());
    KafkaClusterTest.diffToExpected(adminServerDeployment, expectedResource);
}
Also used : ManagedKafka(org.bf2.operator.resources.v1alpha1.ManagedKafka) TlsKeyPair(org.bf2.operator.resources.v1alpha1.TlsKeyPair) OperandOverrideManager(org.bf2.operator.managers.OperandOverrideManager) Deployment(io.fabric8.kubernetes.api.model.apps.Deployment) OperandOverride(org.bf2.operator.managers.OperandOverrideManager.OperandOverride) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Deployment (io.fabric8.kubernetes.api.model.apps.Deployment)1 OperandOverrideManager (org.bf2.operator.managers.OperandOverrideManager)1 OperandOverride (org.bf2.operator.managers.OperandOverrideManager.OperandOverride)1 ManagedKafka (org.bf2.operator.resources.v1alpha1.ManagedKafka)1 TlsKeyPair (org.bf2.operator.resources.v1alpha1.TlsKeyPair)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 CsvSource (org.junit.jupiter.params.provider.CsvSource)1