Skip to content

Commit

Permalink
Merge pull request #35154 from phillip-kruger/dev-ui-remove-testing
Browse files Browse the repository at this point in the history
Remove Old Dev UI: Core Continuous Testing
  • Loading branch information
gsmet authored Aug 10, 2023
2 parents fc1e846 + cd32b70 commit 0ccca64
Show file tree
Hide file tree
Showing 23 changed files with 341 additions and 1,576 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public void test() throws Exception {
when().get("/hello/three").then().statusCode(200);
when().get("/q/dev").then().statusCode(404);
when().get("/q/metrics").then().statusCode(404);
when().get("/dev-v1/resources/images/favicon.ico").then().statusCode(200);
when().get("/dev-v1/resources/css/tests.css").then().statusCode(200);
when().get("/dev-ui/favicon.ico").then().statusCode(200);
when().get("/dev-ui/qwc/qwc-extension.js").then().statusCode(200);
when().get("/metrics").then().statusCode(200)
.body(containsString("/goodbye/{message}"))
.body(containsString("/dev"));
Expand All @@ -97,9 +97,9 @@ public void test() throws Exception {
"quarkus.http.non-application-root-path=/bob\nquarkus.http.root-path=/bob"));

when().get("/bob/hello/three").then().statusCode(200);
when().get("/bob/dev-v1").then().statusCode(200);
when().get("/bob/dev-v1/resources/images/favicon.ico").then().statusCode(200);
when().get("/bob/dev-v1/resources/css/tests.css").then().statusCode(200);
when().get("/bob/dev-ui").then().statusCode(200);
when().get("/bob/dev-ui/favicon.ico").then().statusCode(200);
when().get("/bob/dev-ui/qwc/qwc-extension.js").then().statusCode(200);
when().get("/bob/metrics").then().statusCode(200)
.body(containsString("/hello/{message}")) // http root prefix is removed in output
.body(containsString("/bob/dev"));
Expand All @@ -115,8 +115,8 @@ public void test() throws Exception {
"quarkus.http.non-application-root-path=/george"));

when().get("/bob/hello/three").then().statusCode(200);
when().get("/george/dev-v1").then().statusCode(200);
when().get("/george/dev-v1/resources/images/favicon.ico").then().statusCode(200);
when().get("/george/dev-ui").then().statusCode(200);
when().get("/george/dev-ui/favicon.ico").then().statusCode(200);
when().get("/george/metrics").then().statusCode(200)
.body(containsString("/hello/{message}")); // no longer matches pattern
when().get("/bob/test/requests").then().statusCode(200)
Expand All @@ -131,8 +131,8 @@ public void test() throws Exception {
"quarkus.http.non-application-root-path=george"));

when().get("/bob/hello/three").then().statusCode(200);
when().get("/bob/george/dev-v1").then().statusCode(200);
when().get("/bob/george/dev-v1/resources/images/favicon.ico").then().statusCode(200);
when().get("/bob/george/dev-ui").then().statusCode(200);
when().get("/bob/george/dev-ui/favicon.ico").then().statusCode(200);
when().get("/bob/george/metrics").then().statusCode(200)
.body(containsString("/hello/{message}")); // no longer matches pattern, http root removed
when().get("/bob/test/requests").then().statusCode(200)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.io.IOException;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -71,8 +73,9 @@ JsonRPCProvidersBuildItem createJsonRPCService(LaunchModeBuildItem launchModeBui
registerRunAllMethod(launchModeBuildItem);
registerRunFailedMethod(launchModeBuildItem);
registerToggleBrokenOnlyMethod(launchModeBuildItem);
registerToggleInstrumentationMethod(launchModeBuildItem);
registerGetResultsMethod(launchModeBuildItem);

registerGetStatusMethod(launchModeBuildItem);
return new JsonRPCProvidersBuildItem(NAMESPACE, ContinuousTestingJsonRPCService.class);
}

Expand Down Expand Up @@ -174,6 +177,60 @@ private void registerToggleBrokenOnlyMethod(LaunchModeBuildItem launchModeBuildI
});
}

private void registerToggleInstrumentationMethod(LaunchModeBuildItem launchModeBuildItem) {
DevConsoleManager.register(NAMESPACE + DASH + "toggleInstrumentation", ignored -> {

try {
Optional<TestSupport> ts = TestSupport.instance();
if (testsDisabled(launchModeBuildItem, ts)) {
return false;
}
TestSupport testSupport = ts.get();
return testSupport.toggleInstrumentation();
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}

private void registerGetStatusMethod(LaunchModeBuildItem launchModeBuildItem) {
DevConsoleManager.register(NAMESPACE + DASH + "getStatus", ignored -> {
try {
Optional<TestSupport> ts = TestSupport.instance();
if (testsDisabled(launchModeBuildItem, ts)) {
return null;
}
TestSupport testSupport = ts.get();
TestSupport.RunStatus status = testSupport.getStatus();

if (status == null) {
return null;
}

Map<String, Long> testStatus = new HashMap<>();

long lastRun = status.getLastRun();
testStatus.put("lastRun", lastRun);
if (lastRun > 0) {
TestRunResults result = testSupport.getResults();
testStatus.put("testsFailed", result.getCurrentFailedCount());
testStatus.put("testsPassed", result.getCurrentPassedCount());
testStatus.put("testsSkipped", result.getCurrentSkippedCount());
testStatus.put("testsRun", result.getFailedCount() + result.getPassedCount());
testStatus.put("totalTestsFailed", result.getFailedCount());
testStatus.put("totalTestsPassed", result.getPassedCount());
testStatus.put("totalTestsSkipped", result.getSkippedCount());
}
//get running last, as otherwise if the test completes in the meantime you could see
//both running and last run being the same number
testStatus.put("running", status.getRunning());
return testStatus;
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}

private void registerGetResultsMethod(LaunchModeBuildItem launchModeBuildItem) {
DevConsoleManager.register(NAMESPACE + DASH + "getResults", ignored -> {
ObjectMapper objectMapper = new ObjectMapper(); // Remove in favior of build in.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 0ccca64

Please sign in to comment.