-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[controller] setup test controller in TestLogCompactionService
- created TestRepushOrchestratorImpl, a dummy RepushOrchestrator implementation for testing
- Loading branch information
Whitney Deng
committed
Dec 13, 2024
1 parent
759c2ae
commit 8a9dc9f
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
...grationTest/java/com/linkedin/venice/endToEnd/logcompaction/TestLogCompactionService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.linkedin.venice.endToEnd.logcompaction; | ||
|
||
import static com.linkedin.venice.ConfigKeys.LOG_COMPACTION_ENABLED; | ||
import static com.linkedin.venice.ConfigKeys.REPUSH_ORCHESTRATOR_CLASS_NAME; | ||
import static com.linkedin.venice.ConfigKeys.SCHEDULED_LOG_COMPACTION_INTERVAL_MS; | ||
import static com.linkedin.venice.integration.utils.VeniceClusterWrapperConstants.STANDALONE_REGION_NAME; | ||
|
||
import com.linkedin.venice.controller.VeniceController; | ||
import com.linkedin.venice.integration.utils.PubSubBrokerConfigs; | ||
import com.linkedin.venice.integration.utils.PubSubBrokerWrapper; | ||
import com.linkedin.venice.integration.utils.ServiceFactory; | ||
import com.linkedin.venice.integration.utils.VeniceControllerCreateOptions; | ||
import com.linkedin.venice.integration.utils.VeniceControllerWrapper; | ||
import com.linkedin.venice.integration.utils.ZkServerWrapper; | ||
import com.linkedin.venice.utils.Utils; | ||
import java.util.Properties; | ||
import java.util.concurrent.TimeUnit; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
|
||
/** | ||
* Integration test for {@link VeniceController} log compaction service. | ||
*/ | ||
public class TestLogCompactionService { | ||
private static final int TEST_TIMEOUT = 60_000; // ms | ||
private static final String CLUSTER_NAME = Utils.getUniqueString("test-cluster"); | ||
private static final String KEY_SCHEMA = "\"string\""; | ||
private static final String VALUE_SCHEMA = "\"string\""; | ||
private static final long TEST_LOG_COMPACTION_INTERVAL_MS = TimeUnit.SECONDS.toMillis(10); | ||
|
||
private VeniceController testChildController; | ||
|
||
@BeforeClass | ||
public void setUp() { | ||
// config custom no-op test RepushOrchestrator implementation class | ||
Properties extraProperties = new Properties(); | ||
extraProperties.setProperty(REPUSH_ORCHESTRATOR_CLASS_NAME, TestRepushOrchestratorImpl.class.getCanonicalName()); | ||
extraProperties.setProperty(LOG_COMPACTION_ENABLED, "true"); | ||
extraProperties.setProperty(SCHEDULED_LOG_COMPACTION_INTERVAL_MS, String.valueOf(TEST_LOG_COMPACTION_INTERVAL_MS)); | ||
|
||
// create test controller | ||
ZkServerWrapper zkServer = ServiceFactory.getZkServer(); | ||
PubSubBrokerWrapper pubSubBrokerWrapper = ServiceFactory.getPubSubBroker( | ||
new PubSubBrokerConfigs.Builder().setZkWrapper(zkServer).setRegionName(STANDALONE_REGION_NAME).build()); | ||
|
||
VeniceControllerWrapper testChildControllerWrapper = ServiceFactory.getVeniceController( | ||
new VeniceControllerCreateOptions.Builder(CLUSTER_NAME, zkServer, pubSubBrokerWrapper) | ||
.extraProperties(extraProperties) | ||
.regionName(STANDALONE_REGION_NAME) | ||
.build()); | ||
testChildController = testChildControllerWrapper.getController(); | ||
} | ||
|
||
@Test(timeOut = TEST_TIMEOUT) | ||
public void testScheduledLogCompaction() { | ||
// TODO LC: create fake stores. first one log-compaction-eligible but throws exception, second one | ||
// log-compaction-eligible, other two not log-compaction-eligible | ||
// String batchStoreName = Utils.getUniqueString("testStoreGraveyardCleanupBatch"); | ||
// NewStoreResponse newStoreResponse = | ||
// parentControllerClient.createNewStore(batchStoreName, "test", "\"string\"", "\"string\""); | ||
// Assert.assertFalse(newStoreResponse.isError()); | ||
|
||
// TODO LC: countdown latch | ||
// TODO LC: assert right store is repushed (check storename) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...ationTest/java/com/linkedin/venice/endToEnd/logcompaction/TestRepushOrchestratorImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.linkedin.venice.endToEnd.logcompaction; | ||
|
||
import com.linkedin.venice.controller.repush.RepushJobResponse; | ||
import com.linkedin.venice.controller.repush.RepushOrchestrator; | ||
|
||
|
||
/** | ||
* This is a dummy no-op implementation of {@link RepushOrchestrator} for testing purposes in {@link TestLogCompactionService}. | ||
*/ | ||
public class TestRepushOrchestratorImpl implements RepushOrchestrator { | ||
public TestRepushOrchestratorImpl() { | ||
} | ||
|
||
@Override | ||
public RepushJobResponse repush(String storeName) { | ||
return null; | ||
} | ||
} |