Skip to content

Commit 1d825fe

Browse files
authored
Avoid executing stress test from gha (#971)
* avoid executing stress test from gha * wrong import * using existing github env
1 parent 7e1165f commit 1d825fe

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ jobs:
1919
with:
2020
java-version: '17'
2121
distribution: 'temurin'
22-
2322
- name: Run java client tests
2423
run: ./gradlew test -p java-client

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

Lines changed: 8 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.BeforeEach;
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.Iterator;
4546
import java.util.List;
4647
import java.util.Objects;
48+
import java.util.Optional;
4749
import java.util.concurrent.CompletableFuture;
4850
import java.util.concurrent.ConcurrentHashMap;
4951
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -287,6 +289,7 @@ public void retryTestNoFlushAndContextExponentialBackoff() throws Exception {
287289
}
288290

289291
@Test
292+
@DisabledIf("isGithubBuild")
290293
public void retryMultiThreadStressTest() throws InterruptedException, IOException {
291294

292295
// DISCLAIMER: this configuration is highly inefficient and only used here to showcase an extreme
@@ -541,4 +544,9 @@ private BulkIngester<Integer> newBulkIngesterNoFlushAndContextAndLongExponential
541544
.backoffPolicy(BackoffPolicy.exponentialBackoff(100L, 8))
542545
);
543546
}
547+
548+
private boolean isGithubBuild(){
549+
return Optional.ofNullable(System.getenv("GITHUB_JOB"))
550+
.isPresent();
551+
}
544552
}

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_JOB"))
628+
.isPresent();
629+
}
623630
}

0 commit comments

Comments
 (0)