Search in sources :

Example 36 with GerritConfig

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

the class CancellationIT method abortPushIfServerDeadlineExceeded.

@Test
@GerritConfig(name = "deadline.default.timeout", value = "1ms")
public void abortPushIfServerDeadlineExceeded() throws Exception {
    testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
    PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo);
    PushOneCommit.Result r = push.to("refs/for/master");
    r.assertErrorStatus("Server Deadline Exceeded (default.timeout=1ms)");
}
Also used : PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 37 with GerritConfig

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

the class CancellationIT method invalidServerDeadlineIsIgnored_missingTimeUnit.

@Test
@GerritConfig(name = "deadline.default.timeout", value = "1")
public void invalidServerDeadlineIsIgnored_missingTimeUnit() 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 38 with GerritConfig

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

the class CancellationIT method clientCanDisableDeadlineOnPushBySettingZeroAsDeadline.

@Test
@GerritConfig(name = "deadline.default.timeout", value = "1ms")
public void clientCanDisableDeadlineOnPushBySettingZeroAsDeadline() throws Exception {
    testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
    List<String> pushOptions = new ArrayList<>();
    pushOptions.add("deadline=0");
    PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo);
    push.setPushOptions(pushOptions);
    PushOneCommit.Result r = push.to("refs/for/master");
    r.assertOkStatus();
}
Also used : ArrayList(java.util.ArrayList) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 39 with GerritConfig

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

the class CancellationIT method nonMatchingServerDeadlineIsIgnored_excludedRequestUriPattern.

@Test
@GerritConfig(name = "deadline.default.timeout", value = "1ms")
@GerritConfig(name = "deadline.default.excludedRequestUriPattern", value = "/projects/.*")
public void nonMatchingServerDeadlineIsIgnored_excludedRequestUriPattern() 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 40 with GerritConfig

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

the class CancellationIT method clientProvidedDeadlineOnPushOverridesServerDeadline.

@Test
@GerritConfig(name = "deadline.default.timeout", value = "1ms")
public void clientProvidedDeadlineOnPushOverridesServerDeadline() throws Exception {
    testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
    List<String> pushOptions = new ArrayList<>();
    pushOptions.add("deadline=2ms");
    PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo);
    push.setPushOptions(pushOptions);
    PushOneCommit.Result r = push.to("refs/for/master");
    r.assertErrorStatus("Client Provided Deadline Exceeded (client.timeout=2ms)");
}
Also used : ArrayList(java.util.ArrayList) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

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