-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Refactor Continuous Testing JSON/RPC #43119
Merged
gsmet
merged 1 commit into
quarkusio:main
from
ueberfuhr-opensource-forks:feature/refactor-continuous-testing-rpc
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
core/devmode-spi/src/main/java/io/quarkus/dev/testing/results/TestClassResultInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.quarkus.dev.testing.results; | ||
|
||
import java.util.List; | ||
|
||
public interface TestClassResultInterface extends Comparable<TestClassResultInterface> { | ||
|
||
String getClassName(); | ||
|
||
List<? extends TestResultInterface> getResults(); | ||
|
||
@Override | ||
default int compareTo(TestClassResultInterface o) { | ||
return getClassName().compareTo(o.getClassName()); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
core/devmode-spi/src/main/java/io/quarkus/dev/testing/results/TestResultInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.quarkus.dev.testing.results; | ||
|
||
import java.util.List; | ||
|
||
public interface TestResultInterface { | ||
List<String> getLogOutput(); | ||
|
||
String getDisplayName(); | ||
|
||
String getTestClass(); | ||
|
||
List<String> getTags(); | ||
|
||
boolean isTest(); | ||
|
||
String getId(); | ||
|
||
long getRunId(); | ||
|
||
long getTime(); | ||
|
||
List<Throwable> getProblems(); | ||
|
||
boolean isReportable(); | ||
|
||
State getState(); | ||
|
||
enum State { | ||
PASSED, | ||
FAILED, | ||
SKIPPED | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
core/devmode-spi/src/main/java/io/quarkus/dev/testing/results/TestRunResultsInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.quarkus.dev.testing.results; | ||
|
||
import java.util.Map; | ||
|
||
public interface TestRunResultsInterface { | ||
long getId(); | ||
|
||
Map<String, ? extends TestClassResultInterface> getResults(); | ||
|
||
long getStartedTime(); | ||
|
||
long getCompletedTime(); | ||
|
||
long getTotalTime(); | ||
|
||
long getPassedCount(); | ||
|
||
long getFailedCount(); | ||
|
||
long getSkippedCount(); | ||
|
||
long getCurrentPassedCount(); | ||
|
||
long getCurrentFailedCount(); | ||
|
||
long getCurrentSkippedCount(); | ||
|
||
long getTotalCount(); | ||
|
||
long getCurrentTotalCount(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify the purpose of all these new interfaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test results are stored into objects of type
TestRunResults
,TestClassResult
andTestResult
. They are returned to theContinuousTestingJsonRPCService
as a genericjava.lang.Object
and there transformed to JSON - then sent to the browser for UI rendering. Because my intention was to avoid passing the objects through the RPC service without any API awareness, validation..., the RPC service needs the objects typified.Unfortunately, the module, where the JSON RPC service is placed, does not have a compile dependency to the module where the Test result types are declared. (And I did not want to change this, because this might lead to a cyclic dependency.) So I declared the interfaces (whose names might sound uncreative, because I did not want to change the implementation classes' names to avoid too much diffs) in one module where both have access to. (I'm not sure if this is the correct module, but I found the
ContinuousTestingSharedStateManager
there, so I think it is intended so)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthermore, the interfaces have the advantage that we can be aware of which informationen in required for the Continuous Testing UI, and which information is not. (that is not part of the interface) This makes further refactoring easier, because we now only have compile-time dependencies. (The test results are also used for printing out in the console for example.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is unclear for me: Why are the classes
TestRunResults
,TestClassResult
andTestResult
placed into a deployment module (core-deployment
)? They could also be placed intodevelopment-mode-spi
, where the interfaces are now? This might avoid the need of the interfaces. (see the class diagram)