Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/main/java/com/rabbitmq/stream/perf/StreamPerfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public class StreamPerfTest implements Callable<Integer> {

@CommandLine.Option(
names = {"--max-length-bytes", "-mlb"},
description = "max size of created streams",
description = "max size of created streams, use 0 for no limit",
defaultValue = "20gb",
converter = Utils.ByteCapacityTypeConverter.class)
private ByteCapacity maxLengthBytes;
Expand Down Expand Up @@ -976,10 +976,13 @@ public Integer call() throws Exception {
private void createStream(Environment environment, String stream) {
StreamCreator streamCreator =
environment.streamCreator().stream(stream)
.maxLengthBytes(this.maxLengthBytes)
.maxSegmentSizeBytes(this.maxSegmentSize)
.leaderLocator(this.leaderLocator);

if (this.maxLengthBytes.toBytes() != 0) {
streamCreator.maxLengthBytes(this.maxLengthBytes);
}

if (this.maxAge != null) {
streamCreator.maxAge(this.maxAge);
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/com/rabbitmq/stream/ByteCapacityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ void fromOk(String value, long expectedValueInBytes) {
assertThat(capacity.toString()).isEqualTo(value);
}

@ValueSource(strings = {"0tb", "0gb", "0mb", "0kb", "0"})
@ParameterizedTest
void zero(String value) {
assertThat(ByteCapacity.from(value).toBytes()).isEqualTo(0);
}

@ParameterizedTest
@ValueSource(strings = {"100.0gb", "abc", "100.0", "-10gb", "10b"})
void fromKo(String value) {
Expand Down