Skip to content

Commit

Permalink
Merge pull request #2368 from ozangunalp/flaky_tests
Browse files Browse the repository at this point in the history
Test flakiness : getMaxNumberOfEventLoop falls back to 1 if number of cores is 4.
  • Loading branch information
ozangunalp authored Nov 7, 2023
2 parents bfb3dea + 2719543 commit 430ebcf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.smallrye.reactive.messaging.kafka.companion.KafkaCompanion;
import io.smallrye.reactive.messaging.kafka.companion.test.KafkaBrokerExtension;
import io.smallrye.reactive.messaging.kafka.companion.test.KafkaBrokerExtension.KafkaBootstrapServers;
import io.vertx.core.impl.cpu.CpuCoreSensor;
import io.vertx.core.json.JsonObject;
import io.vertx.mutiny.core.Vertx;

Expand Down Expand Up @@ -83,4 +84,15 @@ public KafkaMapBasedConfig newCommonConfigForSource() {
"graceful-shutdown", false,
"channel-name", topic);
}

public int getMaxNumberOfEventLoop(int expected) {
// On Github Actions, only one event loop is created.
int cpus = CpuCoreSensor.availableProcessors();
// For some reason when Github Actions has 4 cores it'll still run on 1 event loop thread
if (cpus <= 4) {
return 1;
}
return Math.min(expected, cpus / 2);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -864,9 +864,4 @@ public void setName(String name) {
}
}

private int getMaxNumberOfEventLoop(int expected) {
// On Github Actions, only one event loop is created.
return Math.min(expected, Runtime.getRuntime().availableProcessors() / 2);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,4 @@ public long count() {
}
}

private int getMaxNumberOfEventLoop(int expected) {
// On Github Actions, only one event loop is created.
return Math.min(expected, Runtime.getRuntime().availableProcessors() / 2);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,4 @@ public void setName(String name) {
}
}

private int getMaxNumberOfEventLoop(int expected) {
// On Github Actions, only one event loop is created.
return Math.min(expected, Runtime.getRuntime().availableProcessors() / 2);
}
}

0 comments on commit 430ebcf

Please sign in to comment.