[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,12 +22,18 @@ 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 {
|
||||||
|
// Cannot use expectThrows here because blacklisted tests will throw an
|
||||||
|
// InternalAssumptionViolatedException rather than an AssertionError
|
||||||
|
super.test();
|
||||||
|
fail("should have failed because of missing role");
|
||||||
|
} catch (AssertionError ae) {
|
||||||
assertThat(ae.getMessage(),
|
assertThat(ae.getMessage(),
|
||||||
either(containsString("action [cluster:monitor/xpack/ml")).or(containsString("action [cluster:admin/xpack/ml")));
|
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("returned [403 Forbidden]"));
|
||||||
assertThat(ae.getMessage(), containsString("is unauthorized for user [no_ml]"));
|
assertThat(ae.getMessage(), containsString("is unauthorized for user [no_ml]"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] getCredentials() {
|
protected String[] getCredentials() {
|
||||||
|
|
Loading…
Reference in New Issue