[GitHub Actions] Tune thread count for Maven and surefire plugin forks. Increase runners with 10% more than requested.
This commit is contained in:
5
.github/actions/increase-runners/action.yml
vendored
5
.github/actions/increase-runners/action.yml
vendored
@@ -16,5 +16,6 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
source ./scripts/kubeconfig-runners.sh
|
||||
./scripts/increase-runners.sh ${{ inputs.inc }} ${{ inputs.max }}
|
||||
echo "::notice ::Increased runners with ${{ inputs.inc }}"
|
||||
INC=$((11 * ${{ inputs.inc }} / 10))
|
||||
./scripts/increase-runners.sh $INC ${{ inputs.max }}
|
||||
echo "::notice ::Increased runners with $INC"
|
||||
|
||||
5
.github/actions/scale-runners-up/action.yml
vendored
5
.github/actions/scale-runners-up/action.yml
vendored
@@ -82,8 +82,9 @@ runs:
|
||||
echo "::notice ::Scaling stream-apps-gh-runners to ${{ inputs.max_parallel }} pods"
|
||||
source ./scripts/kubeconfig-runners.sh
|
||||
IDLE=$(./scripts/count-runners-idle.sh runners-stream-ci)
|
||||
if ((IDLE < ${{ inputs.max_parallel }})); then
|
||||
REQUEST=$((${{ inputs.max_parallel }} - IDLE))
|
||||
INC=$((11 * ${{ inputs.max_parallel }} / 10))
|
||||
if ((IDLE < INC)); then
|
||||
REQUEST=$((INC - IDLE))
|
||||
echo "::info Requesting $REQUEST runners with $IDLE idle"
|
||||
./scripts/scale-cluster-pods.sh stream-apps-gh-runners $REQUEST --add 1
|
||||
else
|
||||
|
||||
2
.github/workflows/ci-pr.yml
vendored
2
.github/workflows/ci-pr.yml
vendored
@@ -53,7 +53,7 @@ jobs:
|
||||
VERBOSE: ${{ github.debug && 'true' || '' }}
|
||||
run: |
|
||||
BUILD_DIR=$(realpath $MAIN_PATH)
|
||||
MAVEN_OPT="-U -B -T 1C -s $ROOT_DIR/.settings.xml ${{ inputs.verbose && '--debug' || '' }}"
|
||||
MAVEN_OPT="-U -B -T 0.3C -s $ROOT_DIR/.settings.xml ${{ inputs.verbose && '--debug' || '' }}"
|
||||
echo "::notice ::building - stream-applications-build"
|
||||
set +e
|
||||
$BUILD_DIR/build-folder.sh stream-applications-build install -DskipTests
|
||||
|
||||
2
.github/workflows/common.yml
vendored
2
.github/workflows/common.yml
vendored
@@ -203,7 +203,7 @@ jobs:
|
||||
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
|
||||
run: |
|
||||
ROOT_DIR=$(realpath $PWD)
|
||||
MAVEN_OPT="-U -B -T 1C -s $ROOT_DIR/.settings.xml ${{ inputs.verbose && '--debug' || '' }}"
|
||||
MAVEN_OPT="-U -B -T 0.3C -s $ROOT_DIR/.settings.xml ${{ inputs.verbose && '--debug' || '' }}"
|
||||
pushd stream-applications > /dev/null
|
||||
echo "::notice ::building - stream-applications-build,functions,applications/stream-applications-core"
|
||||
set -e
|
||||
|
||||
@@ -23,9 +23,9 @@ elif [ "$VERBOSE" == "false" ]; then
|
||||
MAVEN_OPTS="-q"
|
||||
fi
|
||||
if [ "$MAVEN_OPTS" == "" ]; then
|
||||
MAVEN_OPTS="-s ./.settings.xml -B -T 1C"
|
||||
MAVEN_OPTS="-s ./.settings.xml -B -T 0.3C"
|
||||
else
|
||||
MAVEN_OPTS="$MAVEN_OPTS -s ./.settings.xml -B -T 1C"
|
||||
MAVEN_OPTS="$MAVEN_OPTS -s ./.settings.xml -B -T 0.3C"
|
||||
fi
|
||||
|
||||
if [ "$1" == "" ]; then
|
||||
|
||||
@@ -16,14 +16,12 @@
|
||||
|
||||
package org.springframework.cloud.fn.consumer.websocket;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.Timeout;
|
||||
|
||||
@@ -82,22 +80,13 @@ public class WebsocketConsumerTests {
|
||||
@Timeout(TIMEOUT)
|
||||
public void testMultipleMessageSingleSubscriber() throws Exception {
|
||||
WebsocketConsumerClientHandler handler = new WebsocketConsumerClientHandler("handler_0", MESSAGE_COUNT, TIMEOUT);
|
||||
try (WebSocketSession session = doHandshake(handler)) {
|
||||
assertThat(session.isOpen());
|
||||
List<String> messagesToSend = submitMultipleMessages(MESSAGE_COUNT);
|
||||
List<String> received = new ArrayList<>();
|
||||
Awaitility.await()
|
||||
.atMost(Duration.ofSeconds(10))
|
||||
.until(() -> {
|
||||
handler.await();
|
||||
received.addAll(handler.getReceivedMessages());
|
||||
return received.size() == MESSAGE_COUNT;
|
||||
}
|
||||
);
|
||||
doHandshake(handler);
|
||||
|
||||
assertThat(received.size()).isEqualTo(MESSAGE_COUNT);
|
||||
messagesToSend.forEach(s -> assertThat(received.contains(s)).isTrue());
|
||||
}
|
||||
List<String> messagesToSend = submitMultipleMessages(MESSAGE_COUNT);
|
||||
handler.await();
|
||||
|
||||
assertThat(handler.getReceivedMessages().size()).isEqualTo(MESSAGE_COUNT);
|
||||
messagesToSend.forEach(s -> assertThat(handler.getReceivedMessages().contains(s)).isTrue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -110,25 +99,13 @@ public class WebsocketConsumerTests {
|
||||
// submit a single message
|
||||
String payload = UUID.randomUUID().toString();
|
||||
websocketConsumer.accept(MessageBuilder.withPayload(payload).build());
|
||||
List<String> responses = new ArrayList<>();
|
||||
|
||||
// await completion on each handler
|
||||
for (WebsocketConsumerClientHandler handler : handlers) {
|
||||
Awaitility.await()
|
||||
.atMost(Duration.ofSeconds(5))
|
||||
.until(() -> {
|
||||
handler.await();
|
||||
if (!handler.getReceivedMessages().isEmpty()) {
|
||||
responses.add(handler.getReceivedMessages().get(0));
|
||||
}
|
||||
return !handler.getReceivedMessages().isEmpty();
|
||||
});
|
||||
|
||||
handler.await();
|
||||
assertThat(handler.getReceivedMessages().size()).isEqualTo(1);
|
||||
assertThat(handler.getReceivedMessages().get(0)).isEqualTo(payload);
|
||||
}
|
||||
assertThat(responses.size()).isEqualTo(handlers.size());
|
||||
responses.forEach(s -> {
|
||||
assertThat(s).isEqualTo(payload);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -143,22 +120,16 @@ public class WebsocketConsumerTests {
|
||||
|
||||
// wait on each handle
|
||||
for (WebsocketConsumerClientHandler handler : handlers) {
|
||||
Awaitility.await()
|
||||
.atMost(Duration.ofSeconds(5))
|
||||
.until(() -> {
|
||||
handler.await();
|
||||
if (handler.getReceivedMessages().size() == messagesReceived.size()) {
|
||||
return handler.getReceivedMessages().equals(messagesReceived);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
handler.await();
|
||||
assertThat(handler.getReceivedMessages().size()).isEqualTo(messagesReceived.size());
|
||||
assertThat(handler.getReceivedMessages()).isEqualTo(messagesReceived);
|
||||
}
|
||||
}
|
||||
|
||||
private WebSocketSession doHandshake(WebsocketConsumerClientHandler handler)
|
||||
throws InterruptedException, ExecutionException {
|
||||
String wsEndpoint = "ws://localhost:" + this.consumerServer.getPort() + this.properties.getPath();
|
||||
return new StandardWebSocketClient().execute(handler, wsEndpoint).get();
|
||||
return new StandardWebSocketClient().doHandshake(handler, wsEndpoint).get();
|
||||
}
|
||||
|
||||
private List<String> submitMultipleMessages(int messageCount) {
|
||||
|
||||
@@ -149,6 +149,7 @@
|
||||
<version>${maven-surefire-plugin.version}</version>
|
||||
<configuration>
|
||||
<parallel>classes</parallel>
|
||||
<forkCount>0.3C</forkCount>
|
||||
<redirectTestOutputToFile>true</redirectTestOutputToFile>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@@ -326,6 +327,7 @@
|
||||
<version>${maven-surefire-plugin.version}</version>
|
||||
<configuration>
|
||||
<parallel>classes</parallel>
|
||||
<forkCount>0.3C</forkCount>
|
||||
<excludedGroups>integration</excludedGroups>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@@ -342,6 +344,7 @@
|
||||
<version>${maven-surefire-plugin.version}</version>
|
||||
<configuration>
|
||||
<parallel>classes</parallel>
|
||||
<forkCount>0.3C</forkCount>
|
||||
<groups>integration</groups>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
Reference in New Issue
Block a user