Don't modify All-Projects state in acceptance tests

We would like to reuse a running server across tests, so we shouldn't
modify All-Projects in ways that might affect later methods. Read-only
operations (e.g. listing child projects) are still generally ok, as
are idempotent modifications in setUp that are expected by all test
methods.

Change-Id: I3d47da484ae92339f326bb9344986d51730ca2de
This commit is contained in:
Dave Borowitz
2015-03-27 09:48:48 -07:00
parent 0daea1b1de
commit 9ed5325b0c
9 changed files with 77 additions and 89 deletions

View File

@@ -34,6 +34,7 @@ import com.google.gerrit.acceptance.PushOneCommit;
import com.google.gerrit.acceptance.RestResponse;
import com.google.gerrit.acceptance.RestSession;
import com.google.gerrit.acceptance.TestProjectInput;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.extensions.api.changes.ReviewInput;
import com.google.gerrit.extensions.client.ListChangesOption;
import com.google.gerrit.extensions.common.ApprovalInfo;
@@ -54,6 +55,7 @@ import com.google.gerrit.server.edit.ChangeEditUtil;
import com.google.gerrit.server.edit.UnchangedCommitMessageException;
import com.google.gerrit.server.git.ProjectConfig;
import com.google.gerrit.server.project.InvalidChangeOperationException;
import com.google.gerrit.server.project.Util;
import com.google.gson.stream.JsonReader;
import com.google.gwtorm.server.SchemaFactory;
import com.google.inject.Inject;
@@ -623,10 +625,11 @@ public class ChangeEditIT extends AbstractDaemonTest {
@Test
public void editCommitMessageCopiesLabelScores() throws Exception {
String cr = "Code-Review";
ProjectConfig cfg = projectCache.checkedGet(allProjects).getConfig();
cfg.getLabelSections().get(cr)
.setCopyAllScoresIfNoCodeChange(true);
saveProjectConfig(allProjects, cfg);
ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
LabelType codeReview = Util.codeReview();
codeReview.setCopyAllScoresIfNoCodeChange(true);
cfg.getLabelSections().put(cr, codeReview);
saveProjectConfig(project, cfg);
String changeId = change.getKey().get();
ReviewInput r = new ReviewInput();