Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Old Dev UI: Core Continuous Testing #35154

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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