Skip to content

Commit

Permalink
Update filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyeh committed Apr 12, 2024
1 parent af98ec6 commit d9b19f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void saveGossipMessageDecodingError(
if (!enabled) {
return;
}
final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, topic);
final String fileName = String.format("%s.ssz", arrivalTimestamp);
final Path topicPath =
Path.of(GOSSIP_MESSAGES_DIR).resolve(DECODING_ERROR_SUB_DIR).resolve(topic);
saveBytesToFile(
Expand All @@ -70,7 +70,7 @@ public void saveGossipRejectedMessageToFile(
if (!enabled) {
return;
}
final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, topic);
final String fileName = String.format("%s.ssz", arrivalTimestamp);
final Path topicPath = Path.of(GOSSIP_MESSAGES_DIR).resolve(REJECTED_SUB_DIR).resolve(topic);
saveBytesToFile("rejected gossip message", topicPath.resolve(fileName), decodedMessage);
}
Expand All @@ -80,8 +80,7 @@ public void saveInvalidBlockToFile(
if (!enabled) {
return;
}
final String fileName =
String.format("slot%s_root%s.ssz", slot, blockRoot.toUnprefixedHexString());
final String fileName = String.format("%s_%s.ssz", slot, blockRoot.toUnprefixedHexString());
saveBytesToFile("invalid block", Path.of(INVALID_BLOCK_DIR).resolve(fileName), blockSsz);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void saveGossipMessageDecodingError_shouldSaveToFile(@TempDir Path tempDir) {
final String topic = "test_topic";
manager.saveGossipMessageDecodingError("test_topic", arrivalTimestamp, messageBytes);

final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, topic);
final String fileName = String.format("%s.ssz", arrivalTimestamp);
final Path expectedFile =
tempDir
.resolve("gossip_messages")
Expand All @@ -61,7 +61,7 @@ void saveGossipMessageDecodingError_shouldNotSaveToFileWhenDisabled(@TempDir Pat
manager.saveGossipMessageDecodingError("test_topic", arrivalTimestamp, messageBytes);
assertThat(manager.isEnabled()).isFalse();

final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, "test_topic");
final String fileName = String.format("%s.ssz", arrivalTimestamp);
final Path expectedFile =
tempDir.resolve("gossip_messages").resolve("decoding_error").resolve(fileName);
checkFileNotExist(expectedFile);
Expand All @@ -75,7 +75,7 @@ void saveGossipRejectedMessageToFile_shouldSaveToFile(@TempDir Path tempDir) {
final String topic = "test_topic";
manager.saveGossipRejectedMessageToFile("test_topic", arrivalTimestamp, messageBytes);

final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, topic);
final String fileName = String.format("%s.ssz", arrivalTimestamp);
final Path expectedFile =
tempDir.resolve("gossip_messages").resolve("rejected").resolve(topic).resolve(fileName);
checkBytesSavedToFile(expectedFile, messageBytes);
Expand All @@ -89,7 +89,7 @@ void saveGossipRejectedMessageToFile_shouldNotSaveToFileWhenDisabled(@TempDir Pa
manager.saveGossipRejectedMessageToFile("test_topic", arrivalTimestamp, messageBytes);
assertThat(manager.isEnabled()).isFalse();

final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, "test_topic");
final String fileName = String.format("%s.ssz", arrivalTimestamp);
final Path expectedFile =
tempDir.resolve("gossip_messages").resolve("rejected").resolve(fileName);
checkFileNotExist(expectedFile);
Expand All @@ -102,8 +102,7 @@ void saveInvalidBlockToFile_shouldSaveToFile(@TempDir Path tempDir) {
manager.saveInvalidBlockToFile(block.getSlot(), block.getRoot(), block.sszSerialize());

final String fileName =
String.format(
"slot%s_root%s.ssz", block.getSlot(), block.getRoot().toUnprefixedHexString());
String.format("%s_%s.ssz", block.getSlot(), block.getRoot().toUnprefixedHexString());
final Path expectedFile = tempDir.resolve("invalid_blocks").resolve(fileName);
checkBytesSavedToFile(expectedFile, block.sszSerialize());
}
Expand All @@ -116,8 +115,7 @@ void saveInvalidBlockToFile_shouldNotSaveToFileWhenDisabled(@TempDir Path tempDi
assertThat(manager.isEnabled()).isFalse();

final String fileName =
String.format(
"slot%s_root%s.ssz", block.getSlot(), block.getRoot().toUnprefixedHexString());
String.format("%s_%s.ssz", block.getSlot(), block.getRoot().toUnprefixedHexString());
final Path expectedFile = tempDir.resolve("invalid_blocks").resolve(fileName);
checkFileNotExist(expectedFile);
}
Expand Down

0 comments on commit d9b19f3

Please sign in to comment.