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

Don't rely on vert.x for CT tests #19816

Merged
merged 1 commit into from
Sep 1, 2021
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
7 changes: 0 additions & 7 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1540,13 +1540,6 @@
<artifactId>quarkus-vertx-http-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-deployment</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-web</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package io.quarkus.deployment.dev.testing;

import java.util.function.Consumer;

import io.quarkus.dev.testing.ContinuousTestingSharedStateManager;

public class ContinuousTestingSharedStateListener implements TestListener {

private volatile ContinuousTestingSharedStateManager.State lastState;

@Override
public void listenerRegistered(TestController testController) {

}

@Override
public void testsEnabled() {
if (lastState == null) {
ContinuousTestingSharedStateManager
.setLastState(new ContinuousTestingSharedStateManager.State(
ContinuousTestingSharedStateManager.getLastState().lastRun, true, false,
0, 0, 0, 0,
0, 0, 0, ContinuousTestingSharedStateManager.getLastState().isBrokenOnly,
ContinuousTestingSharedStateManager.getLastState().isTestOutput,
ContinuousTestingSharedStateManager.getLastState().isInstrumentationBasedReload,
ContinuousTestingSharedStateManager.getLastState().isLiveReload));
} else {
ContinuousTestingSharedStateManager
.setLastState(lastState);
}
}

@Override
public void testsDisabled() {
ContinuousTestingSharedStateManager.setRunning(false);
}

@Override
public void testRunStarted(Consumer<TestRunListener> listenerConsumer) {
ContinuousTestingSharedStateManager.setInProgress(true);
listenerConsumer.accept(new TestRunListener() {

@Override
public void runComplete(TestRunResults testRunResults) {
lastState = new ContinuousTestingSharedStateManager.State(testRunResults.getId(), true, false,
testRunResults.getPassedCount() +
testRunResults.getFailedCount() +
testRunResults.getSkippedCount(),
testRunResults.getPassedCount(),
testRunResults.getFailedCount(), testRunResults.getSkippedCount(),
testRunResults.getCurrentPassedCount(), testRunResults.getCurrentFailedCount(),
testRunResults.getCurrentSkippedCount(),
ContinuousTestingSharedStateManager.getLastState().isBrokenOnly,
ContinuousTestingSharedStateManager.getLastState().isTestOutput,
ContinuousTestingSharedStateManager.getLastState().isInstrumentationBasedReload,
ContinuousTestingSharedStateManager.getLastState().isLiveReload);
ContinuousTestingSharedStateManager.setLastState(lastState);
}

@Override
public void noTests(TestRunResults results) {
runComplete(results);
}

@Override
public void runAborted() {
ContinuousTestingSharedStateManager.setInProgress(false);
}
});

}

@Override
public void setBrokenOnly(boolean bo) {
ContinuousTestingSharedStateManager.setBrokenOnly(bo);
}

@Override
public void setTestOutput(boolean to) {
ContinuousTestingSharedStateManager.setTestOutput(to);
}

@Override
public void setInstrumentationBasedReload(boolean ibr) {
ContinuousTestingSharedStateManager.setInstrumentationBasedReload(ibr);
}

@Override
public void setLiveReloadEnabled(boolean lre) {
ContinuousTestingSharedStateManager.setLiveReloadEnabled(lre);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ LogCleanupFilterBuildItem handle() {

static volatile boolean testingSetup;

@BuildStep
TestListenerBuildItem sharedStateListener() {
return new TestListenerBuildItem(new ContinuousTestingSharedStateListener());
}

@BuildStep(onlyIf = IsDevelopment.class)
@Produce(LogHandlerBuildItem.class)
@Produce(TestSetupBuildItem.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
package io.quarkus.dev.testing;

import java.util.concurrent.CopyOnWriteArraySet;
import java.util.function.Consumer;

public class ContinuousTestingSharedStateManager {

private static final CopyOnWriteArraySet<Consumer<State>> stateListeners = new CopyOnWriteArraySet<>();
public static final State INITIAL_STATE = new State(-1, false, false, 0, 0, 0, 0, 0, 0, 0, false, false, false, true);
private static volatile State lastState = INITIAL_STATE;

public static void addStateListener(Consumer<State> stateListener) {
stateListeners.add(stateListener);
if (lastState != null) {
stateListener.accept(lastState);
}
}

public static void removeStateListener(Consumer<State> stateListener) {
stateListeners.remove(stateListener);
}

public static void reset() {
setLastState(INITIAL_STATE);
}

public static void setLastState(State state) {
lastState = state;
for (var sl : stateListeners) {
sl.accept(state);
}
}

public static State getLastState() {
return lastState;
}

public static void setInProgress(boolean inProgress) {
State state = lastState;
if (state != null) {
setLastState(
new State(state.lastRun, state.running, inProgress, state.run, state.passed, state.failed, state.skipped,
state.currentPassed, state.currentFailed, state.currentSkipped, state.isBrokenOnly,
state.isTestOutput, state.isInstrumentationBasedReload, state.isLiveReload));
}
}

public static void setRunning(boolean running) {
State state = lastState;
if (state != null) {
setLastState(new State(state.lastRun, running, running && state.inProgress, state.run, state.passed, state.failed,
state.skipped,
state.currentPassed, state.currentFailed, state.currentSkipped, state.isBrokenOnly, state.isTestOutput,
state.isInstrumentationBasedReload, state.isLiveReload));
}
}

public static void setBrokenOnly(boolean brokenOnly) {
State state = lastState;
if (state != null) {
setLastState(new State(state.lastRun, state.running, state.inProgress, state.run, state.passed, state.failed,
state.skipped,
state.currentPassed, state.currentFailed, state.currentSkipped, brokenOnly, state.isTestOutput,
state.isInstrumentationBasedReload, state.isLiveReload));
}
}

public static void setTestOutput(boolean testOutput) {
State state = lastState;
if (state != null) {
setLastState(new State(state.lastRun, state.running, state.inProgress, state.run, state.passed, state.failed,
state.skipped,
state.currentPassed, state.currentFailed, state.currentSkipped, state.isBrokenOnly, testOutput,
state.isInstrumentationBasedReload, state.isLiveReload));
}
}

public static void setInstrumentationBasedReload(boolean instrumentationBasedReload) {
State state = lastState;
if (state != null) {
setLastState(new State(state.lastRun, state.running, state.inProgress, state.run, state.passed, state.failed,
state.skipped,
state.currentPassed, state.currentFailed, state.currentSkipped, state.isBrokenOnly, state.isTestOutput,
instrumentationBasedReload, state.isLiveReload));
}
}

public static void setLiveReloadEnabled(boolean liveReload) {
State state = lastState;
if (state != null) {
setLastState(new State(state.lastRun, state.running, state.inProgress, state.run, state.passed, state.failed,
state.skipped,
state.currentPassed, state.currentFailed, state.currentSkipped, state.isBrokenOnly, state.isTestOutput,
state.isInstrumentationBasedReload, liveReload));
}
}

public static class State {
public final long lastRun;
public final boolean running;
public final boolean inProgress;
public final long run;
public final long passed;
public final long failed;
public final long skipped;
public final long currentPassed;
public final long currentFailed;
public final long currentSkipped;
public final boolean isBrokenOnly;
public final boolean isTestOutput;
public final boolean isInstrumentationBasedReload;
public final boolean isLiveReload;

public State(long lastRun, boolean running, boolean inProgress, long run, long passed, long failed, long skipped,
long currentPassed, long currentFailed, long currentSkipped, boolean isBrokenOnly, boolean isTestOutput,
boolean isInstrumentationBasedReload, boolean isLiveReload) {
this.lastRun = lastRun;
this.running = running;
this.inProgress = inProgress;
this.run = run;
this.passed = passed;
this.failed = failed;
this.skipped = skipped;
this.currentPassed = currentPassed;
this.currentFailed = currentFailed;
this.currentSkipped = currentSkipped;
this.isBrokenOnly = isBrokenOnly;
this.isTestOutput = isTestOutput;
this.isInstrumentationBasedReload = isInstrumentationBasedReload;
this.isLiveReload = isLiveReload;
}

@Override
public String toString() {
return "State{" +
"lastRun=" + lastRun +
", running=" + running +
", inProgress=" + inProgress +
", run=" + run +
", passed=" + passed +
", failed=" + failed +
", skipped=" + skipped +
", isBrokenOnly=" + isBrokenOnly +
", isTestOutput=" + isTestOutput +
", isInstrumentationBasedReload=" + isInstrumentationBasedReload +
", isLiveReload=" + isLiveReload +
'}';
}
}
}

This file was deleted.

6 changes: 0 additions & 6 deletions extensions/elytron-security-jdbc/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@
<artifactId>quarkus-resteasy-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-deployment</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
Expand Down
Loading