Skip to content

Commit

Permalink
Remove Old Dev UI: Core Continuous Testing
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Kruger <[email protected]>
  • Loading branch information
phillip-kruger committed Aug 8, 2023
1 parent 972fcce commit 1ce8011
Show file tree
Hide file tree
Showing 22 changed files with 329 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 1ce8011

Please sign in to comment.