use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class CancellationIT method abortIfServerDeadlineExceeded_account.
@Test
@GerritConfig(name = "deadline.default.timeout", value = "1ms")
@GerritConfig(name = "deadline.default.account", value = "1000000")
public void abortIfServerDeadlineExceeded_account() throws Exception {
testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
RestResponse response = adminRestSession.putWithHeaders("/projects/" + name("new"));
assertThat(response.getStatusCode()).isEqualTo(SC_REQUEST_TIMEOUT);
assertThat(response.getEntityContent()).isEqualTo("Server Deadline Exceeded\n\ndefault.timeout=1ms");
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class CancellationIT method nonMatchingServerDeadlineIsIgnored_account.
@Test
@GerritConfig(name = "deadline.default.timeout", value = "1ms")
@GerritConfig(name = "deadline.default.account", value = "999")
public void nonMatchingServerDeadlineIsIgnored_account() throws Exception {
testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
RestResponse response = adminRestSession.putWithHeaders("/projects/" + name("new"));
response.assertCreated();
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class CancellationIT method abortIfServerDeadlineExceeded_excludedRequestUriPattern.
@Test
@GerritConfig(name = "deadline.default.timeout", value = "1ms")
@GerritConfig(name = "deadline.default.excludedRequestUriPattern", value = "/projects/non-matching")
public void abortIfServerDeadlineExceeded_excludedRequestUriPattern() throws Exception {
testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
RestResponse response = adminRestSession.putWithHeaders("/projects/" + name("new"));
assertThat(response.getStatusCode()).isEqualTo(SC_REQUEST_TIMEOUT);
assertThat(response.getEntityContent()).isEqualTo("Server Deadline Exceeded\n\ndefault.timeout=1ms");
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class CancellationIT method advisoryServerDeadlineIsIgnored.
@Test
@GerritConfig(name = "deadline.default.timeout", value = "1ms")
@GerritConfig(name = "deadline.default.isAdvisory", value = "true")
public void advisoryServerDeadlineIsIgnored() throws Exception {
testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
RestResponse response = adminRestSession.putWithHeaders("/projects/" + name("new"));
response.assertCreated();
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class CancellationIT method exceededDeadlineForOneRequestDoesntAbortFollowUpRequest.
@Test
@GerritConfig(name = "deadline.default.timeout", value = "500ms")
public void exceededDeadlineForOneRequestDoesntAbortFollowUpRequest() throws Exception {
ProjectCreationValidationListener projectCreationValidationListener = new ProjectCreationValidationListener() {
@Override
public void validateNewProject(CreateProjectArgs args) throws ValidationException {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException("interrupted during sleep", e);
}
}
};
try (Registration registration = extensionRegistry.newRegistration().add(projectCreationValidationListener)) {
RestResponse response = adminRestSession.putWithHeaders("/projects/" + name("new"));
assertThat(response.getStatusCode()).isEqualTo(SC_REQUEST_TIMEOUT);
assertThat(response.getEntityContent()).isEqualTo("Server Deadline Exceeded\n\ndefault.timeout=500ms");
}
// verify that the exceeded deadline for the previous request, isn't applied to a new request
RestResponse response = adminRestSession.putWithHeaders("/projects/" + name("new2"));
response.assertCreated();
}
Aggregations