Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ public void testRetryWithTheDatabaseNotFoundExceptionWithSessionCreationWaitTime
@Test
public void testRetryWithNoSessionCreationWaitTime() {
mockSpanner.setCreateSessionExecutionTime(
SimulatedExecutionTime.ofExceptions(
SimulatedExecutionTime.ofMinimumAndRandomTimeAndExceptions(
100,
0,
Collections.singletonList(
Status.DEADLINE_EXCEEDED
.withDescription(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void testBulkCreateConnectionsMultiThreaded() throws InterruptedException
});
}
executor.shutdown();
executor.awaitTermination(10L, TimeUnit.SECONDS);
assertThat(executor.awaitTermination(60L, TimeUnit.SECONDS), is(true));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve readability and maintainability, it would be best to extract the magic number 60L into a named constant at the class level. This makes the purpose of the value clear and simplifies future modifications.

For example:

private static final long AWAIT_TERMINATION_TIMEOUT_SECONDS = 60L;

And then use it in the assertion:

assertThat(executor.awaitTermination(AWAIT_TERMINATION_TIMEOUT_SECONDS, TimeUnit.SECONDS), is(true));

// close Spanner instances explicitly. This method will throw an exception if there are any
// connections still open in the pool
closeSpanner();
Expand Down
Loading