Skip to content

Commit

Permalink
Remove test ordering, fix rule setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Janelle Law committed Jul 13, 2021
1 parent ceb5a7e commit b8dbd9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
21 changes: 5 additions & 16 deletions src/test/java/itest/RulesPostFormIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,8 @@
import org.hamcrest.Matchers;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

@TestMethodOrder(OrderAnnotation.class)
class RulesPostFormIT extends ExternalTargetsTest {

static final List<String> CONTAINERS = new ArrayList<>();
Expand All @@ -73,18 +69,16 @@ class RulesPostFormIT extends ExternalTargetsTest {
NULL_RESULT.put("result", null);
}

static MultiMap testRule = MultiMap.caseInsensitiveMultiMap();
static MultiMap testRule;

@BeforeAll
static void setup() throws Exception {
testRule.clear();
testRule = MultiMap.caseInsensitiveMultiMap();
testRule.add("name", "Auto Rule");
testRule.add(
"matchExpression",
"target.annotations.cryostat.JAVA_MAIN=='es.andrewazor.demo.Main'");
testRule.add("description", "AutoRulesIT automated rule");
testRule.add("targetAlias", "es.andrewazor.demo.Main");
testRule.add("eventSpecifier", "template=Continuous,type=TARGET");
testRule.add("archivalPeriodSeconds", "60");
testRule.add("preservedArchives", "3");
testRule.add("description", "AutoRulesIT automated rule");
}

@AfterAll
Expand All @@ -95,7 +89,6 @@ static void cleanup() throws Exception {
}

@Test
@Order(1)
void testAddRuleThrowsWhenFormAttributesNull() throws Exception {
CompletableFuture<JsonObject> postResponse = new CompletableFuture<>();

Expand All @@ -113,7 +106,6 @@ void testAddRuleThrowsWhenFormAttributesNull() throws Exception {
}

@Test
@Order(2)
void testAddRuleThrowsWhenMimeNull() throws Exception {
CompletableFuture<JsonObject> postResponse = new CompletableFuture<>();

Expand All @@ -131,7 +123,6 @@ void testAddRuleThrowsWhenMimeNull() throws Exception {
}

@Test
@Order(3)
void testAddRuleThrowsWhenMimeUnsupported() throws Exception {
CompletableFuture<JsonObject> postResponse = new CompletableFuture<>();

Expand All @@ -149,7 +140,6 @@ void testAddRuleThrowsWhenMimeUnsupported() throws Exception {
}

@Test
@Order(4)
void testAddRuleThrowsWhenMimeInvalid() throws Exception {
CompletableFuture<JsonObject> postResponse = new CompletableFuture<>();

Expand All @@ -167,7 +157,6 @@ void testAddRuleThrowsWhenMimeInvalid() throws Exception {
}

@Test
@Order(5)
void testAddRuleThrowsWhenRuleNameAlreadyExists() throws Exception {
CompletableFuture<JsonObject> postResponse = new CompletableFuture<>();

Expand Down
13 changes: 1 addition & 12 deletions src/test/java/itest/RulesPostJsonIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@
import org.hamcrest.Matchers;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

@TestMethodOrder(OrderAnnotation.class)
class RulesPostJsonIT extends ExternalTargetsTest {

static final List<String> CONTAINERS = new ArrayList<>();
Expand All @@ -78,11 +74,9 @@ class RulesPostJsonIT extends ExternalTargetsTest {
static void setup() throws Exception {
testRule = new JsonObject();
testRule.put("name", "Test_Rule");
testRule.put("targetAlias", "es.andrewazor.demo.Main");
testRule.put("description", "AutoRulesIT automated rule");
testRule.put("eventSpecifier", "template=Continuous,type=TARGET");
testRule.put(
"matchExpression",
"target.annotations.cryostat.JAVA_MAIN=='es.andrewazor.demo.Main'");
}

@AfterAll
Expand All @@ -93,7 +87,6 @@ static void cleanup() throws Exception {
}

@Test
@Order(1)
void testAddRuleThrowsWhenJsonAttributesNull() throws Exception {
CompletableFuture<JsonObject> postResponse = new CompletableFuture<>();

Expand All @@ -111,7 +104,6 @@ void testAddRuleThrowsWhenJsonAttributesNull() throws Exception {
}

@Test
@Order(2)
void testAddRuleThrowsWhenMimeNull() throws Exception {
CompletableFuture<JsonObject> postResponse = new CompletableFuture<>();

Expand All @@ -129,7 +121,6 @@ void testAddRuleThrowsWhenMimeNull() throws Exception {
}

@Test
@Order(3)
void testAddRuleThrowsWhenMimeUnsupported() throws Exception {
CompletableFuture<JsonObject> postResponse = new CompletableFuture<>();

Expand All @@ -147,7 +138,6 @@ void testAddRuleThrowsWhenMimeUnsupported() throws Exception {
}

@Test
@Order(4)
void testAddRuleThrowsWhenMimeInvalid() throws Exception {
CompletableFuture<JsonObject> postResponse = new CompletableFuture<>();

Expand All @@ -165,7 +155,6 @@ void testAddRuleThrowsWhenMimeInvalid() throws Exception {
}

@Test
@Order(5)
void testAddRuleThrowsWhenRuleNameAlreadyExists() throws Exception {
CompletableFuture<JsonObject> postResponse = new CompletableFuture<>();

Expand Down

0 comments on commit b8dbd9b

Please sign in to comment.