Skip to content

Commit 7a21886

Browse files
committed
avoid executing stress test from gha
1 parent 98750f6 commit 7a21886

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

.github/workflows/unit-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@ jobs:
2020
java-version: '17'
2121
distribution: 'temurin'
2222

23+
- name: Set env
24+
run: echo "github_test=true" >> $GITHUB_ENV
25+
2326
- name: Run java client tests
2427
run: ./gradlew test -p java-client

java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngesterRetryPolicyTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838
import org.jetbrains.annotations.Nullable;
3939
import org.junit.jupiter.api.BeforeEach;
4040
import org.junit.jupiter.api.Test;
41+
import org.junit.jupiter.api.condition.DisabledIf;
4142

43+
import javax.swing.text.html.Option;
4244
import java.io.IOException;
4345
import java.util.ArrayList;
4446
import java.util.Iterator;
4547
import java.util.List;
4648
import java.util.Objects;
49+
import java.util.Optional;
4750
import java.util.concurrent.CompletableFuture;
4851
import java.util.concurrent.ConcurrentHashMap;
4952
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -287,6 +290,7 @@ public void retryTestNoFlushAndContextExponentialBackoff() throws Exception {
287290
}
288291

289292
@Test
293+
@DisabledIf("isGithubBuild")
290294
public void retryMultiThreadStressTest() throws InterruptedException, IOException {
291295

292296
// DISCLAIMER: this configuration is highly inefficient and only used here to showcase an extreme
@@ -541,4 +545,9 @@ private BulkIngester<Integer> newBulkIngesterNoFlushAndContextAndLongExponential
541545
.backoffPolicy(BackoffPolicy.exponentialBackoff(100L, 8))
542546
);
543547
}
548+
549+
private boolean isGithubBuild(){
550+
return Optional.ofNullable(System.getenv("github_test"))
551+
.map(Boolean::valueOf).orElse(false);
552+
}
544553
}

java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngesterTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@
3838
import org.jetbrains.annotations.Nullable;
3939
import org.junit.jupiter.api.Assertions;
4040
import org.junit.jupiter.api.Test;
41+
import org.junit.jupiter.api.condition.DisabledIf;
4142

4243
import java.io.IOException;
4344
import java.util.ArrayList;
4445
import java.util.Arrays;
4546
import java.util.Collections;
4647
import java.util.List;
48+
import java.util.Optional;
4749
import java.util.concurrent.CompletableFuture;
4850
import java.util.concurrent.CountDownLatch;
4951
import java.util.concurrent.ExecutorService;
@@ -176,6 +178,7 @@ private void multiThreadTest(int maxOperations, int maxRequests, int numThreads,
176178
}
177179

178180
@Test
181+
@DisabledIf("isGithubBuild")
179182
public void multiThreadStressTest() throws InterruptedException, IOException {
180183

181184
String index = "bulk-ingester-stress-test";
@@ -620,4 +623,8 @@ public void close() throws IOException {
620623
}
621624
}
622625
}
626+
private boolean isGithubBuild(){
627+
return Optional.ofNullable(System.getenv("github_test"))
628+
.map(Boolean::valueOf).orElse(false);
629+
}
623630
}

0 commit comments

Comments
 (0)