Merge branch 'stable-2.15' into stable-2.16
* stable-2.15: Init: Increase severity log level to error on exceptions Bazel: Fix genrule2 to clean up temporary folder content AbstractIndexTests: Inline constant assertChangeQuery string parameter AbstractIndexTests: Align assertChangeQuery method access with its use Change-Id: Ifcd40ccd0acdf923d57281e9e01e3e5be8583345
This commit is contained in:
@@ -146,7 +146,7 @@ public class BaseInit extends SiteProgram {
|
|||||||
} catch (OrmException e) {
|
} catch (OrmException e) {
|
||||||
String msg = "Couldn't upgrade schema. Expected if slave and read-only database";
|
String msg = "Couldn't upgrade schema. Expected if slave and read-only database";
|
||||||
System.err.println(msg);
|
System.err.println(msg);
|
||||||
logger.atWarning().withCause(e).log(msg);
|
logger.atSevere().withCause(e).log(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
init.initializer.postRun(sysInjector);
|
init.initializer.postRun(sysInjector);
|
||||||
|
@@ -73,7 +73,7 @@ public abstract class AbstractIndexTests extends AbstractDaemonTest {
|
|||||||
disableChangeIndexWrites();
|
disableChangeIndexWrites();
|
||||||
amendChange(changeId, "second test", "test2.txt", "test2");
|
amendChange(changeId, "second test", "test2.txt", "test2");
|
||||||
|
|
||||||
assertChangeQuery("message:second", change.getChange(), false);
|
assertChangeQuery(change.getChange(), false);
|
||||||
enableChangeIndexWrites();
|
enableChangeIndexWrites();
|
||||||
|
|
||||||
changeIndexedCounter.clear();
|
changeIndexedCounter.clear();
|
||||||
@@ -83,7 +83,7 @@ public abstract class AbstractIndexTests extends AbstractDaemonTest {
|
|||||||
|
|
||||||
changeIndexedCounter.assertReindexOf(changeInfo, 1);
|
changeIndexedCounter.assertReindexOf(changeInfo, 1);
|
||||||
|
|
||||||
assertChangeQuery("message:second", change.getChange(), true);
|
assertChangeQuery(change.getChange(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -98,7 +98,7 @@ public abstract class AbstractIndexTests extends AbstractDaemonTest {
|
|||||||
disableChangeIndexWrites();
|
disableChangeIndexWrites();
|
||||||
amendChange(changeId, "second test", "test2.txt", "test2");
|
amendChange(changeId, "second test", "test2.txt", "test2");
|
||||||
|
|
||||||
assertChangeQuery("message:second", change.getChange(), false);
|
assertChangeQuery(change.getChange(), false);
|
||||||
enableChangeIndexWrites();
|
enableChangeIndexWrites();
|
||||||
|
|
||||||
changeIndexedCounter.clear();
|
changeIndexedCounter.clear();
|
||||||
@@ -115,12 +115,11 @@ public abstract class AbstractIndexTests extends AbstractDaemonTest {
|
|||||||
|
|
||||||
changeIndexedCounter.assertReindexOf(changeInfo, 1);
|
changeIndexedCounter.assertReindexOf(changeInfo, 1);
|
||||||
|
|
||||||
assertChangeQuery("message:second", change.getChange(), true);
|
assertChangeQuery(change.getChange(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertChangeQuery(String q, ChangeData change, boolean assertTrue)
|
private void assertChangeQuery(ChangeData change, boolean assertTrue) throws Exception {
|
||||||
throws Exception {
|
List<Integer> ids = query("message:second").stream().map(c -> c._number).collect(toList());
|
||||||
List<Integer> ids = query(q).stream().map(c -> c._number).collect(toList());
|
|
||||||
if (assertTrue) {
|
if (assertTrue) {
|
||||||
assertThat(ids).contains(change.getId().get());
|
assertThat(ids).contains(change.getId().get());
|
||||||
} else {
|
} else {
|
||||||
|
@@ -21,6 +21,7 @@ def genrule2(cmd, **kwargs):
|
|||||||
"ROOT=$$PWD",
|
"ROOT=$$PWD",
|
||||||
"TMP=$$(mktemp -d || mktemp -d -t bazel-tmp)",
|
"TMP=$$(mktemp -d || mktemp -d -t bazel-tmp)",
|
||||||
"(" + cmd + ")",
|
"(" + cmd + ")",
|
||||||
|
"rm -rf $$TMP",
|
||||||
])
|
])
|
||||||
native.genrule(
|
native.genrule(
|
||||||
cmd = cmd,
|
cmd = cmd,
|
||||||
|
Reference in New Issue
Block a user