Skip to content

Commit

Permalink
test: additional logs in BatcherImplTest
Browse files Browse the repository at this point in the history
Investigating issue googleapis#1931.
  • Loading branch information
suztomo committed Dec 4, 2023
1 parent a621b8c commit a097345
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ jobs:
- run: java -version
- name: Unit Tests
run: |
# The logging option is to investigate a flaky test in
# https://github.com/googleapis/sdk-platform-java/issues/1931
mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-Dfmt.skip -DenableTestCoverage
-Dfmt.skip -DenableTestCoverage \
-Djava.util.logging.SimpleFormatter.format="%1$tY %1$tl:%1$tM:%1$tS.%1$tL %2$s %4$s: %5$s%6$s%n"
- run: bazelisk version
- name: Install Maven modules
run: |
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ jobs:
cache: maven
- run: mvn -version
- name: Unit Tests
run: mvn install --errors --batch-mode --no-transfer-progress -Dcheckstyle.skip -T 1C
run: |
# The logging option is to investigate a flaky test in
# https://github.com/googleapis/sdk-platform-java/issues/1931
mvn install --errors --batch-mode --no-transfer-progress -Dcheckstyle.skip -T 1C \
-Djava.util.logging.SimpleFormatter.format="%1$tY %1$tl:%1$tM:%1$tS.%1$tL %2$s %4$s: %5$s%6$s%n"
- name: Create issue if previous step fails
if: ${{ failure() }}
env:
Expand Down Expand Up @@ -59,7 +63,11 @@ jobs:
- run: mvn -version
- name: Test with Java 8
# Direct goal invocation ("surefire:test") prevents recompiling tests
run: mvn surefire:test --errors --batch-mode --no-transfer-progress -T 1C
run: |
# The logging option is to investigate a flaky test in
# https://github.com/googleapis/sdk-platform-java/issues/1931
mvn surefire:test --errors --batch-mode --no-transfer-progress -T 1C \
-Djava.util.logging.SimpleFormatter.format="%1$tY %1$tl:%1$tM:%1$tS.%1$tL %2$s %4$s: %5$s%6$s%n"
- name: Create issue if previous step fails
if: ${{ failure() }}
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
@RunWith(JUnit4.class)
public class BatcherImplTest {

private static final Logger logger = Logger.getLogger(BatcherImplTest.class.getName());

private static final ScheduledExecutorService EXECUTOR =
Executors.newSingleThreadScheduledExecutor();

Expand Down Expand Up @@ -889,15 +891,20 @@ public void run() {
() -> {
try {
Thread.sleep(throttledTime);
logger.info("Calling flowController.release");
flowController.release(1, 1);
logger.info("Called flowController.release");
} catch (InterruptedException e) {
}
});

try {
logger.info("Calling future.get(10 ms)");
future.get(10, TimeUnit.MILLISECONDS);
logger.info("future.get(10 ms) unexpectedly returned.");
assertWithMessage("adding elements to batcher should be blocked by FlowControlled").fail();
} catch (TimeoutException e) {
logger.info("future.get(10 ms) timed out expectedly.");
// expected
}

Expand Down

0 comments on commit a097345

Please sign in to comment.