Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-alhuang committed Jun 11, 2024
1 parent 9dbc608 commit 86a7934
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ List<List<ChannelData<T>>> getData() {
this.owningClient = client;
this.channelCache = cache;
this.targetStage = targetStage;
if (this.targetStage != null) {
this.clientPrefix = this.targetStage.getClientPrefix();
}
this.counter = new AtomicLong(0);
this.registerService = new RegisterService<>(client, isTestMode);
this.isNeedFlush = false;
Expand Down Expand Up @@ -188,7 +191,7 @@ List<List<ChannelData<T>>> getData() {
client.getRequestBuilder(),
client.getName(),
DEFAULT_MAX_UPLOAD_RETRIES);
this.clientPrefix = this.targetStage.clientPrefix;
this.clientPrefix = this.targetStage.getClientPrefix();
} else {
this.targetStage = null;
}
Expand Down Expand Up @@ -730,7 +733,7 @@ private String getBlobPath(String volumeHash) {

/** For TESTING */
String getBlobPath(Calendar calendar, String volumeHash) {
if (isTestMode) {
if (isTestMode && this.clientPrefix == null) {
this.clientPrefix = "testPrefix";
}
Utils.assertStringNotNullOrEmpty("client prefix", this.clientPrefix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,9 @@ public void testGetFilePath() {
TestContext<?> testContext = testContextFactory.create(false);
FlushService<?> flushService = testContext.flushService;
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
String clientPrefix = "honk";
String outputString = flushService.getBlobPath(calendar, null);
Path outputPath = Paths.get(outputString);
Assert.assertTrue(outputPath.getFileName().toString().contains(clientPrefix));
Assert.assertTrue(outputPath.getFileName().toString().contains("client_prefix"));
Assert.assertTrue(
calendar.get(Calendar.MINUTE)
- Integer.parseInt(outputPath.getParent().getFileName().toString())
Expand Down

0 comments on commit 86a7934

Please sign in to comment.