Skip to content

Commit

Permalink
Added missing properties to fix BeekeeperUnreferencedPathSchedulerApi…
Browse files Browse the repository at this point in the history
…aryIntegrationTest
  • Loading branch information
Hamza Jugon committed Nov 21, 2024
1 parent 90c2871 commit 45fcc26
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.testcontainers.containers.localstack.LocalStackContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
Expand All @@ -66,11 +67,14 @@
import com.expediagroup.beekeeper.integration.utils.ContainerTestUtils;
import com.expediagroup.beekeeper.scheduler.apiary.BeekeeperSchedulerApiary;

import com.hotels.beeju.extensions.ThriftHiveMetaStoreJUnitExtension;

@Testcontainers
public class BeekeeperUnreferencedPathSchedulerApiaryIntegrationTest extends BeekeeperIntegrationTestBase {

private static final int TIMEOUT = 5;
private static final String APIARY_QUEUE_URL_PROPERTY = "properties.apiary.queue-url";
private static final String DRY_RUN_ENABLED_PROPERTY = "properties.dry-run-enabled";

private static final String QUEUE = "apiary-receiver-queue";
private static final String SCHEDULED_ORPHANED_METRIC = "paths-scheduled";
Expand All @@ -81,6 +85,10 @@ public class BeekeeperUnreferencedPathSchedulerApiaryIntegrationTest extends Bee
private static final LocalStackContainer SQS_CONTAINER = ContainerTestUtils.awsContainer(SQS);
private static AmazonSQS amazonSQS;

@RegisterExtension
public ThriftHiveMetaStoreJUnitExtension thriftHiveMetaStore = new ThriftHiveMetaStoreJUnitExtension(
DATABASE_NAME_VALUE);

@BeforeAll
public static void init() {
String queueUrl = ContainerTestUtils.queueUrl(SQS_CONTAINER, QUEUE);
Expand All @@ -93,12 +101,17 @@ public static void init() {
@AfterAll
public static void teardown() {
System.clearProperty(APIARY_QUEUE_URL_PROPERTY);
System.clearProperty("properties.metastore-uri");
System.clearProperty("properties.dry-run-enabled");

amazonSQS.shutdown();
}

@BeforeEach
public void setup() {
System.setProperty("properties.metastore-uri", thriftHiveMetaStore.getThriftConnectionUri());
System.setProperty("properties.dry-run-enabled", "false");

amazonSQS.purgeQueue(new PurgeQueueRequest(ContainerTestUtils.queueUrl(SQS_CONTAINER, QUEUE)));
executorService.execute(() -> BeekeeperSchedulerApiary.main(new String[] {}));
await().atMost(Duration.ONE_MINUTE).until(BeekeeperSchedulerApiary::isRunning);
Expand All @@ -108,6 +121,9 @@ public void setup() {
public void stop() throws InterruptedException {
BeekeeperSchedulerApiary.stop();
executorService.awaitTermination(5, TimeUnit.SECONDS);

System.clearProperty("properties.metastore-uri");
System.clearProperty("properties.dry-run-enabled");
}

@Test
Expand Down

0 comments on commit 45fcc26

Please sign in to comment.