[ML] Tolerate InternalAssumptionViolatedException in overridden test (elastic/x-pack-elasticsearch#1657)
In order for elastic/elasticsearch#25100 to work, overridden test() methods that call ESClientYamlSuiteTestCase.test() must not consume any InternalAssumptionViolatedException that ESClientYamlSuiteTestCase.test() throws. Relates elastic/x-pack-elasticsearch#1650 Original commit: elastic/x-pack-elasticsearch@081ccaa0a6
This commit is contained in:
parent
887538d6bc
commit
f865755259
|
@ -22,11 +22,17 @@ public class MlWithSecurityInsufficientRoleIT extends MlWithSecurityIT {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void test() throws IOException {
|
public void test() throws IOException {
|
||||||
AssertionError ae = expectThrows(AssertionError.class, super::test);
|
try {
|
||||||
assertThat(ae.getMessage(),
|
// Cannot use expectThrows here because blacklisted tests will throw an
|
||||||
either(containsString("action [cluster:monitor/xpack/ml")).or(containsString("action [cluster:admin/xpack/ml")));
|
// InternalAssumptionViolatedException rather than an AssertionError
|
||||||
assertThat(ae.getMessage(), containsString("returned [403 Forbidden]"));
|
super.test();
|
||||||
assertThat(ae.getMessage(), containsString("is unauthorized for user [no_ml]"));
|
fail("should have failed because of missing role");
|
||||||
|
} catch (AssertionError ae) {
|
||||||
|
assertThat(ae.getMessage(),
|
||||||
|
either(containsString("action [cluster:monitor/xpack/ml")).or(containsString("action [cluster:admin/xpack/ml")));
|
||||||
|
assertThat(ae.getMessage(), containsString("returned [403 Forbidden]"));
|
||||||
|
assertThat(ae.getMessage(), containsString("is unauthorized for user [no_ml]"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue