Test: remove @Repeat instead of suppressing
Original commit: elastic/x-pack-elasticsearch@cc61a9d14a
This commit is contained in:
parent
0533b55dbc
commit
bf9a8024ca
|
@ -5,10 +5,8 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.shield.audit.logfile;
|
package org.elasticsearch.shield.audit.logfile;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Repeat;
|
|
||||||
import org.elasticsearch.action.IndicesRequest;
|
import org.elasticsearch.action.IndicesRequest;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
import org.elasticsearch.action.support.IndicesOptions;
|
||||||
import org.elasticsearch.common.SuppressForbidden;
|
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.network.NetworkUtils;
|
import org.elasticsearch.common.network.NetworkUtils;
|
||||||
|
@ -41,8 +39,6 @@ import static org.mockito.Mockito.when;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SuppressForbidden(reason = "this test should repeat")
|
|
||||||
@Repeat(iterations = 10)
|
|
||||||
public class LoggingAuditTrailTests extends ElasticsearchTestCase {
|
public class LoggingAuditTrailTests extends ElasticsearchTestCase {
|
||||||
|
|
||||||
private static enum RestContent {
|
private static enum RestContent {
|
||||||
|
@ -483,8 +479,7 @@ public class LoggingAuditTrailTests extends ElasticsearchTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressForbidden(reason = "this test should repeat")
|
@Test
|
||||||
@Test @Repeat(iterations = 10)
|
|
||||||
public void testOriginAttributes() throws Exception {
|
public void testOriginAttributes() throws Exception {
|
||||||
MockMessage message = new MockMessage();
|
MockMessage message = new MockMessage();
|
||||||
String text = LoggingAuditTrail.originAttributes(message);
|
String text = LoggingAuditTrail.originAttributes(message);
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.shield.authc.esusers;
|
package org.elasticsearch.shield.authc.esusers;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Repeat;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import org.elasticsearch.action.Action;
|
import org.elasticsearch.action.Action;
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
|
@ -16,7 +15,6 @@ import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.client.ClusterAdminClient;
|
import org.elasticsearch.client.ClusterAdminClient;
|
||||||
import org.elasticsearch.client.IndicesAdminClient;
|
import org.elasticsearch.client.IndicesAdminClient;
|
||||||
import org.elasticsearch.client.support.Headers;
|
import org.elasticsearch.client.support.Headers;
|
||||||
import org.elasticsearch.common.SuppressForbidden;
|
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -82,8 +80,7 @@ public class ESUsersRealmTests extends ElasticsearchTestCase {
|
||||||
assertThat(user.roles(), arrayContaining("role1", "role2"));
|
assertThat(user.roles(), arrayContaining("role1", "role2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressForbidden(reason = "this test should repeat")
|
@Test
|
||||||
@Test @Repeat(iterations = 20)
|
|
||||||
public void testAuthenticate_Caching() throws Exception {
|
public void testAuthenticate_Caching() throws Exception {
|
||||||
Settings settings = Settings.builder()
|
Settings settings = Settings.builder()
|
||||||
.put("cache.hash_algo", Hasher.values()[randomIntBetween(0, Hasher.values().length - 1)].name().toLowerCase(Locale.ROOT))
|
.put("cache.hash_algo", Hasher.values()[randomIntBetween(0, Hasher.values().length - 1)].name().toLowerCase(Locale.ROOT))
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.shield.support;
|
package org.elasticsearch.shield.support;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Repeat;
|
|
||||||
import org.elasticsearch.common.SuppressForbidden;
|
|
||||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -20,7 +18,6 @@ import static org.hamcrest.Matchers.nullValue;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SuppressForbidden(reason = "these tests should repeat")
|
|
||||||
public class ValidationTests extends ElasticsearchTestCase {
|
public class ValidationTests extends ElasticsearchTestCase {
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,14 +38,13 @@ public class ValidationTests extends ElasticsearchTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Repeat(iterations = 100)
|
|
||||||
public void testESUsers_validateUsername() throws Exception {
|
public void testESUsers_validateUsername() throws Exception {
|
||||||
int length = randomIntBetween(1, 30);
|
int length = randomIntBetween(1, 30);
|
||||||
String name = new String(generateValidName(length));
|
String name = new String(generateValidName(length));
|
||||||
assertThat(Validation.ESUsers.validateUsername(name), nullValue());
|
assertThat(Validation.ESUsers.validateUsername(name), nullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Repeat(iterations = 100)
|
@Test
|
||||||
public void testESUsers_validateUsername_Invalid_Length() throws Exception {
|
public void testESUsers_validateUsername_Invalid_Length() throws Exception {
|
||||||
int length = frequently() ? randomIntBetween(31, 200) : 0; // invalid length
|
int length = frequently() ? randomIntBetween(31, 200) : 0; // invalid length
|
||||||
char[] name = new char[length];
|
char[] name = new char[length];
|
||||||
|
@ -58,14 +54,14 @@ public class ValidationTests extends ElasticsearchTestCase {
|
||||||
assertThat(Validation.ESUsers.validateUsername(new String(name)), notNullValue());
|
assertThat(Validation.ESUsers.validateUsername(new String(name)), notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Repeat(iterations = 100)
|
@Test
|
||||||
public void testESUsers_validateUsername_Invalid_Characters() throws Exception {
|
public void testESUsers_validateUsername_Invalid_Characters() throws Exception {
|
||||||
int length = randomIntBetween(1, 30); // valid length
|
int length = randomIntBetween(1, 30); // valid length
|
||||||
String name = new String(generateInvalidName(length));
|
String name = new String(generateInvalidName(length));
|
||||||
assertThat(Validation.ESUsers.validateUsername(name), notNullValue());
|
assertThat(Validation.ESUsers.validateUsername(name), notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Repeat(iterations = 100)
|
@Test
|
||||||
public void testESUsers_validatePassword() throws Exception {
|
public void testESUsers_validatePassword() throws Exception {
|
||||||
String passwd = randomAsciiOfLength(randomIntBetween(0, 20));
|
String passwd = randomAsciiOfLength(randomIntBetween(0, 20));
|
||||||
logger.info(passwd + "[{}]", passwd.length());
|
logger.info(passwd + "[{}]", passwd.length());
|
||||||
|
@ -76,14 +72,14 @@ public class ValidationTests extends ElasticsearchTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Repeat(iterations = 100)
|
@Test
|
||||||
public void testRoles_validateRoleName() throws Exception {
|
public void testRoles_validateRoleName() throws Exception {
|
||||||
int length = randomIntBetween(1, 30);
|
int length = randomIntBetween(1, 30);
|
||||||
String name = new String(generateValidName(length));
|
String name = new String(generateValidName(length));
|
||||||
assertThat(Validation.Roles.validateRoleName(name), nullValue());
|
assertThat(Validation.Roles.validateRoleName(name), nullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Repeat(iterations = 100)
|
@Test
|
||||||
public void testRoles_validateRoleName_Invalid_Length() throws Exception {
|
public void testRoles_validateRoleName_Invalid_Length() throws Exception {
|
||||||
int length = frequently() ? randomIntBetween(31, 200) : 0; // invalid length
|
int length = frequently() ? randomIntBetween(31, 200) : 0; // invalid length
|
||||||
char[] name = new char[length];
|
char[] name = new char[length];
|
||||||
|
@ -93,7 +89,7 @@ public class ValidationTests extends ElasticsearchTestCase {
|
||||||
assertThat(Validation.ESUsers.validateUsername(new String(name)), notNullValue());
|
assertThat(Validation.ESUsers.validateUsername(new String(name)), notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Repeat(iterations = 100)
|
@Test
|
||||||
public void testRoles_validateRoleName_Invalid_Characters() throws Exception {
|
public void testRoles_validateRoleName_Invalid_Characters() throws Exception {
|
||||||
int length = randomIntBetween(1, 30); // valid length
|
int length = randomIntBetween(1, 30); // valid length
|
||||||
String name = new String(generateInvalidName(length));
|
String name = new String(generateInvalidName(length));
|
||||||
|
|
Loading…
Reference in New Issue