Skip to content

Commit

Permalink
test: disable unstable tests and fix some unsable tests (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
xzchaoo authored Mar 29, 2023
1 parent 62c14d7 commit 01cf9ab
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.commons.lang3.RandomStringUtils;
import org.hamcrest.Matchers;
import org.json.JSONObject;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

Expand All @@ -32,6 +33,7 @@
* @author masaimu
* @version 2023-03-23 17:08:00
*/
@Disabled("https://github.com/traas-stack/holoinsight/issues/290")
public class AlertCalculateIT extends BaseIT {

Long currentId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void test_rule_create() {
System.out.println(tenant);
}

@Order(1)
@Order(2)
@Test
public void test_rule_update() {
name = name + "_v2";
Expand All @@ -91,7 +91,7 @@ public void test_rule_update() {
.root("data").body("groupName", eq(name));
}

@Order(2)
@Order(3)
@Test
public void test_rule_delete() {
given() //
Expand All @@ -107,7 +107,7 @@ public void test_rule_delete() {
.body("data", IS_NULL); //
}

@Order(3)
@Order(4)
@Test
public void test_rule_pageQuery() {
Stack<Long> ids = new Stack<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void test_rule_create() {
System.out.println(tenant);
}

@Order(1)
@Order(2)
@Test
public void test_triggerContent() {
AlarmRuleDTO alarmRuleDTO = new AlarmRuleDTO();
Expand Down Expand Up @@ -132,7 +132,7 @@ public void test_triggerContent() {
.path("data.tenant");
}

@Order(2)
@Order(3)
@Test
public void test_rule_update() {
name = name + "_v2";
Expand All @@ -155,7 +155,7 @@ public void test_rule_update() {
.root("data").body("ruleName", eq(name));
}

@Order(3)
@Order(4)
@Test
public void test_rule_delete() {
given() //
Expand All @@ -170,7 +170,7 @@ public void test_rule_delete() {
.body("data", IS_NULL);
}

@Order(4)
@Order(5)
@Test
public void test_rule_pageQuery() {
Stack<Integer> ids = new Stack<>();
Expand Down Expand Up @@ -219,7 +219,7 @@ public boolean matches(Object o) {
}));
}

@Order(5)
@Order(6)
@Test
public void test_alert_calculate() {
Integer ruleId = given() //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void test_rule_create() {
System.out.println(tenant);
}

@Order(1)
@Order(2)
@Test
public void test_rule_update() {
name = name + "_v2";
Expand All @@ -87,7 +87,7 @@ public void test_rule_update() {
.root("data").body("webhookName", eq(name));
}

@Order(2)
@Order(3)
@Test
public void test_rule_delete() {
given() //
Expand All @@ -104,7 +104,7 @@ public void test_rule_delete() {
.body("data", IS_NULL); //
}

@Order(3)
@Order(4)
@Test
public void test_rule_pageQuery() {
Stack<Long> ids = new Stack<>();
Expand Down Expand Up @@ -138,7 +138,7 @@ public void test_rule_pageQuery() {
given() //
.body(new JSONObject(J.toMap(J.toJson(pageRequest)))) //
.when() //
.post("/webapi/alarmDingDingRobot/pageQuery") //
.post("/webapi/alarmWebhook/pageQuery") //
.then() //
.body("success", IS_TRUE) //
.root("data")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.time.Duration;
import java.util.List;
Expand Down Expand Up @@ -146,6 +147,10 @@ protected static InputStream getResourceAsStream(String name) {
}

protected static JSONObject getJsonFromClasspath(String name) {
return new JSONObject(new JSONTokener(getResourceAsStream(name)));
try (InputStream is = getResourceAsStream(name)) {
return new JSONObject(new JSONTokener(is));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void test_rule_create() {
System.out.println(tenant);
}

@Order(1)
@Order(2)
@Test
public void test_rule_update() {
name = name + "_v2";
Expand All @@ -92,7 +92,7 @@ public void test_rule_update() {
.root("data").body("title", eq(name));
}

@Order(2)
@Order(3)
@Test
public void test_rule_delete() {
given() //
Expand All @@ -108,7 +108,7 @@ public void test_rule_delete() {
.body("data", IS_NULL); //
}

@Order(3)
@Order(4)
@Test
public void test_rule_pageQuery() {
Stack<Long> ids = new Stack<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void test_rule_create() {
System.out.println(tenant);
}

@Order(1)
@Order(2)
@Test
public void test_rule_update() {
name = name + "_v2";
Expand Down Expand Up @@ -107,7 +107,7 @@ public void test_rule_update() {
.root("data").body("name", eq(name));
}

@Order(2)
@Order(3)
@Test
public void test_rule_delete() {
given() //
Expand All @@ -123,7 +123,7 @@ public void test_rule_delete() {
.body("data", IS_NULL); //
}

@Order(3)
@Order(4)
@Test
public void test_rule_pageQuery() {
Stack<Long> ids = new Stack<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
junit.jupiter.execution.parallel.enabled=true
junit.jupiter.execution.parallel.mode.default=same_thread
junit.jupiter.execution.parallel.mode.classes.default=concurrent
# dyanmic use thread pool size = 4 * cpu
junit.jupiter.execution.parallel.config.strategy=dynamic
junit.jupiter.execution.parallel.config.dynamic.factor=4

0 comments on commit 01cf9ab

Please sign in to comment.