Search in sources :

Example 1 with EnabledIfSystemProperty

use of org.junit.jupiter.api.condition.EnabledIfSystemProperty in project data-center-helm-charts by atlassian.

the class HelmOutputComparisonTest method record_helm_template_output_matches_expectations.

@ParameterizedTest
@EnumSource(Product.class)
@EnabledIfSystemProperty(named = "recordOutput", matches = "true")
void record_helm_template_output_matches_expectations(final Product product) throws Exception {
    final var actualOutputFile = helm.captureHelmTemplateOutput(product, getHelmValuesFile(product));
    stripBlankLines(actualOutputFile);
    Path destination = Paths.get("src/test/resources/expected_helm_output/" + product + "/output.yaml");
    Files.copy(actualOutputFile, destination, StandardCopyOption.REPLACE_EXISTING);
}
Also used : Path(java.nio.file.Path) EnabledIfSystemProperty(org.junit.jupiter.api.condition.EnabledIfSystemProperty) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with EnabledIfSystemProperty

use of org.junit.jupiter.api.condition.EnabledIfSystemProperty in project zephyr by sunshower-io.

the class DirectoryScannerTest method ensureKernelDefaultDeploymentDirectoryIsScannedForRemovals.

@Test
@SneakyThrows
@EnabledIfSystemProperty(named = "flakytests", matches = "true")
void ensureKernelDefaultDeploymentDirectoryIsScannedForRemovals() {
    val file = createFile();
    kernel.addEventListener(eventListener, ModuleEvents.REMOVED, ModuleEvents.INSTALLED);
    context.put(EntryPoint.ContextEntries.ARGS, new String[] { "--scan" });
    scanner.initialize(context);
    val latch = new CyclicBarrier(1);
    watch(latch);
    val installable = ProjectPlugins.TEST_PLUGIN_1.getFile();
    latch.await();
    latch.reset();
    executorService.submit(() -> {
        try {
            do {
                Thread.sleep(150);
            } while (!scanner.running);
            Files.transferTo(installable, new File(file, "whatever.war"));
            latch.await();
        } catch (Exception ex) {
            fail();
        }
    });
    latch.await();
    latch.reset();
    verify(eventListener, timeout(10000)).onEvent(eq(ModuleEvents.REMOVED), any());
    reset(eventListener);
    executorService.submit(() -> {
        try {
            System.out.println("deleting");
            Thread.sleep(150);
            java.nio.file.Files.delete(new File(file, "whatever.war").getAbsoluteFile().toPath());
        } catch (Exception ex) {
        }
    });
    scanner.stop();
    verify(eventListener, timeout(10000)).onEvent(eq(ModuleEvents.REMOVED), any());
}
Also used : lombok.val(lombok.val) File(java.io.File) CyclicBarrier(java.util.concurrent.CyclicBarrier) EnabledIfSystemProperty(org.junit.jupiter.api.condition.EnabledIfSystemProperty) Test(org.junit.jupiter.api.Test) ZephyrTest(io.sunshower.kernel.test.ZephyrTest) SneakyThrows(lombok.SneakyThrows)

Example 3 with EnabledIfSystemProperty

use of org.junit.jupiter.api.condition.EnabledIfSystemProperty in project mongo-java-server by bwaldvogel.

the class AbstractPerformanceTest method testComplexUpsert.

// https://github.com/bwaldvogel/mongo-java-server/issues/84
@Test
@EnabledIfSystemProperty(named = "run-mongo-java-server-performance-tests", matches = "true")
public void testComplexUpsert() throws Exception {
    Document incUpdate = new Document();
    Document updateQuery = new Document("$inc", incUpdate);
    incUpdate.put("version", 1);
    for (int hour = 0; hour < 24; hour++) {
        for (int minute = 0; minute < 60; minute++) {
            incUpdate.put("data." + hour + "." + minute + ".requests", 0);
            incUpdate.put("data." + hour + "." + minute + ".responses", 0);
            incUpdate.put("data." + hour + "." + minute + ".duration", 0);
        }
    }
    for (int i = 0; i < 10; i++) {
        long start = System.currentTimeMillis();
        collection.updateOne(json("_id: 1"), updateQuery, new UpdateOptions().upsert(true));
        long stop = System.currentTimeMillis();
        log.info("Update took {} ms", stop - start);
    }
}
Also used : Document(org.bson.Document) UpdateOptions(com.mongodb.client.model.UpdateOptions) EnabledIfSystemProperty(org.junit.jupiter.api.condition.EnabledIfSystemProperty) Test(org.junit.jupiter.api.Test)

Example 4 with EnabledIfSystemProperty

use of org.junit.jupiter.api.condition.EnabledIfSystemProperty in project trellis-extensions by trellis-ldp.

the class SNSNotificationServiceTest method testNotification.

@Test
@EnabledIfSystemProperty(named = "trellis.aws.topic", matches = "arn:aws:sns:.*")
void testNotification() {
    when(mockNotification.getIdentifier()).thenReturn(identifier);
    when(mockNotification.getAgents()).thenReturn(singleton(agent));
    when(mockNotification.getObject()).thenReturn(of(object));
    when(mockNotification.getTypes()).thenReturn(singleton(AS.Create));
    when(mockNotification.getObjectTypes()).thenReturn(singleton(LDP.RDFSource));
    when(mockNotification.getCreated()).thenReturn(time);
    final NotificationService svc = new SNSNotificationService(serializer);
    svc.emit(mockNotification);
    verify(mockNotification).getIdentifier();
}
Also used : NotificationService(org.trellisldp.api.NotificationService) EnabledIfSystemProperty(org.junit.jupiter.api.condition.EnabledIfSystemProperty) Test(org.junit.jupiter.api.Test)

Example 5 with EnabledIfSystemProperty

use of org.junit.jupiter.api.condition.EnabledIfSystemProperty in project spring-cloud-dataflow-acceptance-tests by spring-cloud.

the class BatchRemotePartitioningAT method runBatchRemotePartitionJobCloudFoundry.

@Test
@EnabledIfSystemProperty(named = "PLATFORM_TYPE", matches = "cloudfoundry")
public void runBatchRemotePartitionJobCloudFoundry() {
    logger.info("runBatchRemotePartitionJob - cloudfoundry");
    final String prefix = CFConnectionProperties.CLOUDFOUNDRY_PROPERTIES;
    String taskDefinition = TASK_NAME + String.format(" --%s.%s=%s", prefix, "username", cfConnectionProperties.getUsername()) + String.format(" --%s.%s=%s", prefix, "password", cfConnectionProperties.getPassword()) + String.format(" --%s.%s=%s", prefix, "org", cfConnectionProperties.getOrg()) + String.format(" --%s.%s=%s", prefix, "username", cfConnectionProperties.getUsername()) + String.format(" --%s.%s=%s", prefix, "space", cfConnectionProperties.getSpace()) + String.format(" --%s.%s=%s", prefix, "url", cfConnectionProperties.getUrl().toString()) + String.format(" --%s.%s=%s", prefix, "skipSslValidation", cfConnectionProperties.isSkipSslValidation());
    TaskBuilder taskBuilder = Task.builder(dataFlowOperations);
    try (Task task = taskBuilder.name(randomName()).definition(taskDefinition).description("runBatchRemotePartitionJob - cloudfoundry").build()) {
        long launchId = task.launch(Collections.EMPTY_MAP, Arrays.asList("--platform=cloudfoundry"));
        Awaitility.await().until(() -> task.executionStatus(launchId) == TaskExecutionStatus.COMPLETE);
        assertThat(task.executions().size()).isEqualTo(1);
        assertThat(task.execution(launchId).isPresent()).isTrue();
        assertThat(task.execution(launchId).get().getExitCode()).isEqualTo(EXIT_CODE_SUCCESS);
    }
}
Also used : TaskBuilder(org.springframework.cloud.dataflow.rest.client.dsl.task.TaskBuilder) Task(org.springframework.cloud.dataflow.rest.client.dsl.task.Task) EnabledIfSystemProperty(org.junit.jupiter.api.condition.EnabledIfSystemProperty) Test(org.junit.jupiter.api.Test)

Aggregations

EnabledIfSystemProperty (org.junit.jupiter.api.condition.EnabledIfSystemProperty)23 Test (org.junit.jupiter.api.Test)22 File (java.io.File)6 InteractiveTestContext (gov.va.api.health.vistafhirquery.interactivetests.InteractiveTestContext)2 TestContext (gov.va.api.health.vistafhirquery.interactivetests.TestContext)2 ZephyrTest (io.sunshower.kernel.test.ZephyrTest)2 JsonObject (jakarta.json.JsonObject)2 Path (java.nio.file.Path)2 Statement (java.sql.Statement)2 Set (java.util.Set)2 CyclicBarrier (java.util.concurrent.CyclicBarrier)2 SneakyThrows (lombok.SneakyThrows)2 lombok.val (lombok.val)2 Geometry (org.locationtech.jts.geom.Geometry)2 Task (org.springframework.cloud.dataflow.rest.client.dsl.task.Task)2 TaskBuilder (org.springframework.cloud.dataflow.rest.client.dsl.task.TaskBuilder)2 StringInputStream (com.amazonaws.util.StringInputStream)1 MultiStorageService (com.mercedesbenz.sechub.sharedkernel.storage.MultiStorageService)1 UseCaseIdentifier (com.mercedesbenz.sechub.sharedkernel.usecases.UseCaseIdentifier)1 JobStorage (com.mercedesbenz.sechub.storage.core.JobStorage)1