Search in sources :

Example 1 with KubernetesResources

use of com.bakdata.quick.manager.k8s.KubernetesResources in project quick by bakdata.

the class JobCleanerTest method shouldDeleteSucceededJobs.

@Test
void shouldDeleteSucceededJobs() {
    final JobCleaner jobCleaner = new JobCleaner(this.client);
    final KubernetesResources resources = new KubernetesResources();
    final Job deletionJob = resources.createDeletionJob("test", "image", List.of("--key", "value"));
    final Job finalJob = new JobBuilder(deletionJob).withNewStatus().withActive(0).withSucceeded(1).endStatus().build();
    this.kubernetesServer.getClient().batch().v1().jobs().create(finalJob);
    List<Job> jobList = this.kubernetesServer.getClient().batch().v1().jobs().list().getItems();
    assertThat(jobList).hasSize(1);
    assertThatNoException().isThrownBy(jobCleaner::deleteJobs);
    jobList = this.kubernetesServer.getClient().batch().v1().jobs().list().getItems();
    assertThat(jobList).isEmpty();
}
Also used : JobBuilder(io.fabric8.kubernetes.api.model.batch.v1.JobBuilder) KubernetesResources(com.bakdata.quick.manager.k8s.KubernetesResources) Job(io.fabric8.kubernetes.api.model.batch.v1.Job) Test(org.junit.jupiter.api.Test) KubernetesTest(com.bakdata.quick.manager.k8s.KubernetesTest)

Example 2 with KubernetesResources

use of com.bakdata.quick.manager.k8s.KubernetesResources in project quick by bakdata.

the class JobCleanerTest method shouldRunWithoutErrorForJobsWithoutStatus.

@Test
void shouldRunWithoutErrorForJobsWithoutStatus() {
    final JobCleaner jobCleaner = new JobCleaner(this.client);
    final KubernetesResources resources = new KubernetesResources();
    final Job deletionJob = resources.createDeletionJob("test", "image", List.of("--key", "value"));
    this.kubernetesServer.getClient().batch().v1().jobs().create(deletionJob);
    assertThatNoException().isThrownBy(jobCleaner::deleteJobs);
}
Also used : KubernetesResources(com.bakdata.quick.manager.k8s.KubernetesResources) Job(io.fabric8.kubernetes.api.model.batch.v1.Job) Test(org.junit.jupiter.api.Test) KubernetesTest(com.bakdata.quick.manager.k8s.KubernetesTest)

Example 3 with KubernetesResources

use of com.bakdata.quick.manager.k8s.KubernetesResources in project quick by bakdata.

the class KubernetesMirrorServiceTest method setUp.

@BeforeEach
void setUp() {
    final MirrorResourceLoader loader = new MirrorResourceLoader(new KubernetesResources(), this.getDeploymentConfig(), this.getResourceConfig());
    this.mirrorService = new KubernetesMirrorService(new KubernetesResources(), this.getManagerClient(), this.getDeploymentConfig(), loader);
}
Also used : MirrorResourceLoader(com.bakdata.quick.manager.mirror.resources.MirrorResourceLoader) KubernetesResources(com.bakdata.quick.manager.k8s.KubernetesResources) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with KubernetesResources

use of com.bakdata.quick.manager.k8s.KubernetesResources in project quick by bakdata.

the class KubernetesApplicationServiceTest method setUp.

@BeforeEach
void setUp() {
    final ApplicationResourceLoader loader = new ApplicationResourceLoader(new KubernetesResources(), this.kafkaConfig, this.getResourceConfig(), this.getDeploymentConfig());
    this.service = new KubernetesApplicationService(new KubernetesResources(), this.getManagerClient(), loader);
}
Also used : KubernetesResources(com.bakdata.quick.manager.k8s.KubernetesResources) ApplicationResourceLoader(com.bakdata.quick.manager.application.resources.ApplicationResourceLoader) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with KubernetesResources

use of com.bakdata.quick.manager.k8s.KubernetesResources in project quick by bakdata.

the class KubernetesGatewayServiceTest method setUp.

@BeforeEach
void setUp() {
    final GatewayResourceLoader loader = new GatewayResourceLoader(new KubernetesResources(), this.getDeploymentConfig(), this.getResourceConfig(), NAMESPACE);
    this.gatewayService = new KubernetesGatewayService(this.getManagerClient(), this.gatewayClient, this.graphQLToAvroConverter, loader);
}
Also used : GatewayResourceLoader(com.bakdata.quick.manager.gateway.resource.GatewayResourceLoader) KubernetesResources(com.bakdata.quick.manager.k8s.KubernetesResources) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

KubernetesResources (com.bakdata.quick.manager.k8s.KubernetesResources)13 KubernetesTest (com.bakdata.quick.manager.k8s.KubernetesTest)10 Test (org.junit.jupiter.api.Test)10 DeploymentConfig (com.bakdata.quick.manager.config.DeploymentConfig)7 GatewayCreationData (com.bakdata.quick.common.api.model.manager.creation.GatewayCreationData)4 GatewayResourceLoader (com.bakdata.quick.manager.gateway.resource.GatewayResourceLoader)4 MirrorResourceLoader (com.bakdata.quick.manager.mirror.resources.MirrorResourceLoader)4 GatewayClient (com.bakdata.quick.common.api.client.GatewayClient)3 MirrorCreationData (com.bakdata.quick.common.api.model.manager.creation.MirrorCreationData)3 GatewayService (com.bakdata.quick.manager.gateway.GatewayService)3 KubernetesGatewayService (com.bakdata.quick.manager.gateway.KubernetesGatewayService)3 GraphQLToAvroConverter (com.bakdata.quick.manager.graphql.GraphQLToAvroConverter)3 KubernetesMirrorService (com.bakdata.quick.manager.mirror.KubernetesMirrorService)3 MirrorService (com.bakdata.quick.manager.mirror.MirrorService)3 Job (io.fabric8.kubernetes.api.model.batch.v1.Job)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 JobBuilder (io.fabric8.kubernetes.api.model.batch.v1.JobBuilder)2 ApplicationResourceLoader (com.bakdata.quick.manager.application.resources.ApplicationResourceLoader)1 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)1 IntOrString (io.fabric8.kubernetes.api.model.IntOrString)1