-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Do not Submit] Testing if timeout fixes it tests #13254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,6 +128,8 @@ private TestBench( | |
| .createRequestFactory( | ||
| request -> { | ||
| request.setCurlLoggingEnabled(false); | ||
| request.setConnectTimeout(5000); | ||
| request.setReadTimeout(10000); | ||
|
Comment on lines
+131
to
+132
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The timeouts for the TestBench (5s/10s) are hardcoded and inconsistent with the MetadataService timeouts. Centralizing these values into constants or a configuration class would improve maintainability. However, avoid declaring them as 'static final' if there is a plan to allow instance-level configuration in the future. References
|
||
| request.getHeaders().setAccept("application/json"); | ||
| request | ||
| .getHeaders() | ||
|
|
@@ -487,6 +489,14 @@ static final class Builder { | |
|
|
||
| private static final String DEFAULT_CONTAINER_NAME = "default"; | ||
|
|
||
| private static int findFreePort() { | ||
| try (java.net.ServerSocket socket = new java.net.ServerSocket(0)) { | ||
| return socket.getLocalPort(); | ||
| } catch (IOException e) { | ||
| throw new RuntimeException("No free port available", e); | ||
| } | ||
| } | ||
|
|
||
| private boolean ignorePullError; | ||
| private String baseUri; | ||
| private String gRPCBaseUri; | ||
|
|
@@ -497,8 +507,8 @@ static final class Builder { | |
| private Builder() { | ||
| this( | ||
| false, | ||
| DEFAULT_BASE_URI, | ||
| DEFAULT_GRPC_BASE_URI, | ||
| "http://localhost:" + findFreePort(), | ||
| "http://localhost:" + findFreePort(), | ||
| DEFAULT_IMAGE_NAME, | ||
| DEFAULT_IMAGE_TAG, | ||
| DEFAULT_CONTAINER_NAME); | ||
|
|
@@ -550,13 +560,15 @@ public Builder setContainerName(String containerName) { | |
| } | ||
|
|
||
| public TestBench build() { | ||
| String suffix = Optional.ofNullable(System.getProperty("surefire.forkNumber")) | ||
| .orElseGet(() -> java.util.UUID.randomUUID().toString().substring(0, 8)); | ||
| return new TestBench( | ||
| ignorePullError, | ||
| baseUri, | ||
| gRPCBaseUri, | ||
| requireNonNull(dockerImageName, "dockerImageName must be non null"), | ||
| requireNonNull(dockerImageTag, "dockerImageTag must be non null"), | ||
| String.format(Locale.US, "storage-testbench_%s", containerName)); | ||
| String.format(Locale.US, "storage-testbench_%s_%s", containerName, suffix)); | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 1-second connection timeout and 2-second read timeout for the metadata service may be too short for some CI environments, potentially causing flaky test failures. Increasing these to more conservative values (e.g., 5 seconds) is an acceptable temporary fix to unblock CI. If you plan to make these configurable at the instance level in the future, avoid declaring them as 'static final'.
References