use of io.stackgres.operator.conciliation.dbops.StackGresDbOpsContext in project stackgres by ongres.
the class DbOpsJobsGeneratorTest method givenAContextWithADbOpsWithAPastRunAt_shouldGenerateAJob.
@Test
void givenAContextWithADbOpsWithAPastRunAt_shouldGenerateAJob() {
StackGresDbOpsContext context = ImmutableStackGresDbOpsContext.builder().source(dbOps).cluster(cluster).build();
dbOps.getSpec().setRunAt(Instant.now().minusMillis(1000).toString());
var generatedResources = dbOpsJobsGenerator.generateResource(context).collect(Collectors.toUnmodifiableList());
assertEquals(1, generatedResources.size());
}
use of io.stackgres.operator.conciliation.dbops.StackGresDbOpsContext in project stackgres by ongres.
the class DbOpsJobsGeneratorTest method givenAContextWithASingleDbOpsWithoutRunAt_itShouldGenerateAJob.
@Test
void givenAContextWithASingleDbOpsWithoutRunAt_itShouldGenerateAJob() {
StackGresDbOpsContext context = ImmutableStackGresDbOpsContext.builder().source(dbOps).cluster(cluster).build();
dbOps.getSpec().setRunAt(null);
var generatedResources = dbOpsJobsGenerator.generateResource(context).collect(Collectors.toUnmodifiableList());
assertEquals(1, generatedResources.stream().filter(r -> r.getKind().equals("Job")).count());
}
use of io.stackgres.operator.conciliation.dbops.StackGresDbOpsContext in project stackgres by ongres.
the class DbOpsJobsGeneratorTest method givenAContextWithADbOpsWithAFutureRunAt_shouldNotGenerateAJob.
@Test
void givenAContextWithADbOpsWithAFutureRunAt_shouldNotGenerateAJob() {
StackGresDbOpsContext context = ImmutableStackGresDbOpsContext.builder().source(dbOps).cluster(cluster).build();
dbOps.getSpec().setRunAt(Instant.now().plusMillis(1000).toString());
var generatedResources = dbOpsJobsGenerator.generateResource(context).collect(Collectors.toUnmodifiableList());
assertEquals(0, generatedResources.size());
}
Aggregations