Search in sources :

Example 61 with GerritConfig

use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.

the class CancellationIT method nonMatchingServerDeadlineIsIgnored_requestType.

@Test
@GerritConfig(name = "deadline.default.timeout", value = "1ms")
@GerritConfig(name = "deadline.default.requestType", value = "SSH")
public void nonMatchingServerDeadlineIsIgnored_requestType() throws Exception {
    testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
    RestResponse response = adminRestSession.putWithHeaders("/projects/" + name("new"));
    response.assertCreated();
}
Also used : RestResponse(com.google.gerrit.acceptance.RestResponse) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 62 with GerritConfig

use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.

the class CancellationIT method clientProvidedDeadlineOverridesServerDeadline.

@Test
@GerritConfig(name = "deadline.default.timeout", value = "1ms")
public void clientProvidedDeadlineOverridesServerDeadline() throws Exception {
    testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
    RestResponse response = adminRestSession.putWithHeaders("/projects/" + name("new"), new BasicHeader(RestApiServlet.X_GERRIT_DEADLINE, "2ms"));
    assertThat(response.getStatusCode()).isEqualTo(SC_REQUEST_TIMEOUT);
    assertThat(response.getEntityContent()).isEqualTo("Client Provided Deadline Exceeded\n\nclient.timeout=2ms");
}
Also used : RestResponse(com.google.gerrit.acceptance.RestResponse) BasicHeader(org.apache.http.message.BasicHeader) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 63 with GerritConfig

use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.

the class CancellationIT method nonMatchingServerDeadlineIsIgnored_requestUriPattern.

@Test
@GerritConfig(name = "deadline.default.timeout", value = "1ms")
@GerritConfig(name = "deadline.default.requestUriPattern", value = "/changes/.*")
public void nonMatchingServerDeadlineIsIgnored_requestUriPattern() throws Exception {
    testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
    RestResponse response = adminRestSession.putWithHeaders("/projects/" + name("new"));
    response.assertCreated();
}
Also used : RestResponse(com.google.gerrit.acceptance.RestResponse) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 64 with GerritConfig

use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.

the class CancellationIT method invalidServerDeadlineIsIgnored_invalidTimeUnit.

@Test
@GerritConfig(name = "deadline.default.timeout", value = "1x")
public void invalidServerDeadlineIsIgnored_invalidTimeUnit() throws Exception {
    testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
    RestResponse response = adminRestSession.putWithHeaders("/projects/" + name("new"));
    response.assertCreated();
}
Also used : RestResponse(com.google.gerrit.acceptance.RestResponse) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 65 with GerritConfig

use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.

the class GroupsIT method createGroupWithConfiguredNameOfSystemGroup_Conflict.

@Test
@GerritConfig(name = "groups.global:Anonymous-Users.name", value = "All Users")
public void createGroupWithConfiguredNameOfSystemGroup_Conflict() throws Exception {
    ResourceConflictException thrown = assertThrows(ResourceConflictException.class, () -> gApi.groups().create("all users"));
    assertThat(thrown).hasMessageThat().contains("group 'All Users' already exists");
}
Also used : ResourceConflictException(com.google.gerrit.extensions.restapi.ResourceConflictException) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

GerritConfig (com.google.gerrit.acceptance.config.GerritConfig)187 Test (org.junit.Test)185 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)170 RestResponse (com.google.gerrit.acceptance.RestResponse)56 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)40 Registration (com.google.gerrit.acceptance.ExtensionRegistry.Registration)35 Repository (org.eclipse.jgit.lib.Repository)21 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)19 MetaDataUpdate (com.google.gerrit.server.git.meta.MetaDataUpdate)17 InMemoryRepository (org.eclipse.jgit.internal.storage.dfs.InMemoryRepository)17 ExternalIdNotes (com.google.gerrit.server.account.externalids.ExternalIdNotes)16 ReviewInput (com.google.gerrit.extensions.api.changes.ReviewInput)14 TestRepository (org.eclipse.jgit.junit.TestRepository)14 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)11 TestAccount (com.google.gerrit.acceptance.TestAccount)10 Account (com.google.gerrit.entities.Account)10 RevCommit (org.eclipse.jgit.revwalk.RevCommit)10 Project (com.google.gerrit.entities.Project)9 ConfigInfo (com.google.gerrit.extensions.api.projects.ConfigInfo)9 Change (com.google.gerrit.entities.Change)8