Skip to content

Commit

Permalink
Pull request #178: Work 1.24.3
Browse files Browse the repository at this point in the history
Merge in ITB/gitb from work_1.24.3 to master

* commit '5dbb581212da1a1876bfc69d561f144ff5e1e873':
  Preparation for release 1.24.3
  Suppressed CVE-2024-8184 and CVE-2024-6763 as non-applicable
  Updated Angular to v18.2.9
  Library upgrades
  Updated ODC to v11.1.0
  Updated Spring Boot to v3.3.5
  Code cleanup
  [ITB-1708] When stopOnError semantics apply, an error in a flow step's thread should automatically complete pending steps in other threads
  Suppressed CVE-2024-8184 and CVE-2024-6763 as non-applicable
  • Loading branch information
costas80 committed Nov 14, 2024
2 parents 404882d + 5dbb581 commit 2b5f258
Show file tree
Hide file tree
Showing 13 changed files with 272 additions and 221 deletions.
4 changes: 2 additions & 2 deletions gitb-engine/src/main/java/com/gitb/engine/actors/Actor.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public void onReceive(Object message) throws Exception {}
@Override
public void preStart() throws Exception{
super.preStart();
logger.debug(self().path() + " - starting");
logger.debug("{} - starting", self().path());
}

@Override
public void postStop() throws Exception{
super.postStop();
logger.debug(self().path() + " - stopping");
logger.debug("{} - stopping", self().path());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,14 @@ protected OnSuccess<TestStepReportType> handleSuccess(Promise<TestStepReportType
return new OnSuccess<>() {
@Override
public void onSuccess(TestStepReportType result) {
promise.trySuccess(result);
if (result != null) {
/*
* If the report is null this means that we should not mark the step's promise as successfully completed.
* The report in this case is expected to be produced asynchronously. It is important to keep the step's
* promise as not completed as like this we can react to stop notifications.
*/
promise.trySuccess(result);
}
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ public void onReceive(Object message) {
try {
super.onReceive(message);
if (message instanceof ErrorStatusEvent) {
// inform((StatusEvent) message);
handleStatusEvent((StatusEvent) message);
} else if (message instanceof StatusEvent) {
handleStatusEvent((StatusEvent) message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.gitb.engine.TestbedService;
import com.gitb.engine.commands.messaging.TimeoutExpired;
import com.gitb.engine.events.TestStepInputEventBus;
import com.gitb.engine.events.model.ErrorStatusEvent;
import com.gitb.engine.events.model.InputEvent;
import com.gitb.engine.expr.ExpressionHandler;
import com.gitb.engine.expr.resolvers.VariableResolver;
Expand Down Expand Up @@ -57,7 +56,6 @@ public class InteractionStepProcessorActor extends AbstractTestStepActor<UserInt
public static final String NAME = "interaction-p";

private static final Logger logger = LoggerFactory.getLogger(InteractionStepProcessorActor.class);
private boolean receivedInput = false;
private Promise<TestStepReportType> promise;

public InteractionStepProcessorActor(UserInteraction step, TestCaseScope scope, String stepId) {
Expand All @@ -67,7 +65,7 @@ public InteractionStepProcessorActor(UserInteraction step, TestCaseScope scope,
@Override
public void onReceive(Object message) {
if (message instanceof TimeoutExpired) {
if (!receivedInput) {
if (!promise.isCompleted()) {
logger.debug(addMarker(), "Timeout expired while waiting to receive input");
var inputEvent = new InputEvent(scope.getContext().getSessionId(), step.getId(), Collections.emptyList(), step.isAdmin());
this.handleInputEvent(inputEvent);
Expand All @@ -84,14 +82,19 @@ protected void init() {
.getInstance()
.subscribe(self(), classifier);

final ActorContext context = getContext();

promise = Futures.promise();

promise.future().foreach(new OnSuccess<>() {
@Override
public void onSuccess(TestStepReportType result) {
completed(result);
}
}, getContext().dispatcher());

promise.future().failed().foreach(new OnFailure() {
@Override
public void onFailure(Throwable failure) {
updateTestStepStatus(context, new ErrorStatusEvent(failure, scope, self()), null, true);
handleFutureFailure(failure);
}
}, getContext().dispatcher());
}
Expand Down Expand Up @@ -213,17 +216,10 @@ protected void start() {
}
}, context.dispatcher());

future.foreach(new OnSuccess<>() {

@Override
public void onSuccess(TestStepReportType result) {
promise.trySuccess(result);
}
}, context.dispatcher());

future.failed().foreach(new OnFailure() {
@Override
public void onFailure(Throwable failure) { promise.tryFailure(failure);
public void onFailure(Throwable failure) {
promise.tryFailure(failure);
}
}, context.dispatcher());
waiting();
Expand Down Expand Up @@ -254,7 +250,6 @@ private Instruction processInstruction(com.gitb.tdl.Instruction instructionComma
return instruction;
}


/**
* Process TDL InputRequest command and convert it to TBS InputRequest object
*
Expand Down Expand Up @@ -349,12 +344,11 @@ private String resolveTokenValues(VariableResolver variableResolver, String expr

@Override
protected void handleInputEvent(InputEvent event) {
receivedInput = true;
processing();
if (step.isAdmin() && !event.isAdmin()) {
// This was an administrator-level interaction for which we received input from a non-administrator.
// This is not normal and should be logged and recorded as an error.
throw new GITBEngineInternalError(ErrorUtils.errorInfo(ErrorCode.INVALID_SESSION, String.format("User-provided inputs were expected to be received by an administrator - step [%s] - ID [%s]", TestCaseUtils.extractStepDescription(step, scope), stepId)));
promise.tryFailure(new GITBEngineInternalError(ErrorUtils.errorInfo(ErrorCode.INVALID_SESSION, String.format("User-provided inputs were expected to be received by an administrator - step [%s] - ID [%s]", TestCaseUtils.extractStepDescription(step, scope), stepId))));
} else {
logger.debug(MarkerFactory.getDetachedMarker(scope.getContext().getSessionId()), String.format("Handling user-provided inputs - step [%s] - ID [%s]", TestCaseUtils.extractStepDescription(step, scope), stepId));
List<UserInput> userInputs = event.getUserInputs();
Expand Down Expand Up @@ -429,10 +423,16 @@ protected void handleInputEvent(InputEvent event) {
TestCaseScope.ScopedVariable scopedVariable = scope.createVariable(step.getId());
scopedVariable.setValue(interactionResult);
}
completed(report);
promise.trySuccess(report);
}
}

@Override
protected void stop() {
if (promise != null && !promise.isCompleted()) {
promise.tryFailure(new GITBEngineInternalError(ErrorUtils.errorInfo(ErrorCode.CANCELLATION, "Test step ["+stepId+"] is cancelled.")));
}
}

public static ActorRef create(ActorContext context, UserInteraction step, TestCaseScope scope, String stepId) throws Exception {
return context.actorOf(props(InteractionStepProcessorActor.class, step, scope, stepId), getName(NAME));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public class ReceiveStepProcessorActor extends AbstractMessagingStepProcessorAct

private MessagingContext messagingContext;
private TransactionContext transactionContext;
private boolean receivedResponse = false;

private Promise<TestStepReportType> promise;

Expand Down Expand Up @@ -165,14 +164,16 @@ protected void start() {
public void onReceive(Object message) {
try {
if (message instanceof NotificationReceived notificationMessage) {
if (notificationMessage.getError() != null) {
throw notificationMessage.getError();
if (promise != null && !promise.isCompleted()) {
if (notificationMessage.getError() != null) {
promise.tryFailure(notificationMessage.getError());
} else {
logger.debug(addMarker(), "Received notification");
promise.trySuccess(handleMessagingResult(notificationMessage.getReport()));
}
}
logger.debug(addMarker(), "Received notification");
receivedResponse = true;
signalStepStatus(handleMessagingResult(notificationMessage.getReport()));
} else if (message instanceof TimeoutExpired) {
if (!receivedResponse) {
if (promise != null && !promise.isCompleted()) {
VariableResolver resolver = new VariableResolver(scope);
String flagName = null;
if (!StringUtils.isBlank(step.getTimeoutFlag())) {
Expand All @@ -195,7 +196,7 @@ public void onReceive(Object message) {
} else {
logger.debug(addMarker(), "Timeout expired while waiting to receive message");
}
signalStepStatus(handleMessagingResult(MessagingHandlerUtils.getMessagingReportForTimeout(flagName, errorIfTimeout)));
promise.trySuccess(handleMessagingResult(MessagingHandlerUtils.getMessagingReportForTimeout(flagName, errorIfTimeout)));
}
} else {
super.onReceive(message);
Expand Down Expand Up @@ -250,7 +251,7 @@ private TAR handleMessagingResult(MessagingReport report) {

@Override
protected void stop() {
if(promise != null && !promise.isCompleted()) {
if (promise != null && !promise.isCompleted()) {
promise.tryFailure(new GITBEngineInternalError(ErrorUtils.errorInfo(ErrorCode.CANCELLATION, "Test step ["+stepId+"] is cancelled.")));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void onReceive(Object message) {

@Override
protected void stop() {
if(promise != null) {
if (promise != null && !promise.isCompleted()) {
promise.tryFailure(new GITBEngineInternalError(ErrorUtils.errorInfo(ErrorCode.CANCELLATION, "Test step ["+stepId+"] is cancelled.")));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected void handleStatusEvent(StatusEvent event) throws Exception {
try {
getContext().system().actorSelection(SessionActor.getPath(scope.getContext().getSessionId())).tell(new PrepareForStopCommand(scope.getContext().getSessionId(), self()), self());
} catch (Exception e) {
LOG.error(addMarker(), "Error sending the signal to stop the test session from test step actor [" + stepId + "].");
LOG.error(addMarker(), "Error sending the signal to stop the test session from test step actor [{}].", stepId);
}
} else {
// Proceed.
Expand Down
2 changes: 1 addition & 1 deletion gitb-ui/app/models/Constants.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ object Constants {
val UserAttributeAuthenticationLevel = "authLevel"

// When ending in "-snapshot", this is considered a non-published release.
val VersionNumber = "1.24.2"
val VersionNumber = "1.24.3"
val VersionNumberPostfixForResources = ""

}
2 changes: 1 addition & 1 deletion gitb-ui/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ val pekkoVersion = "1.0.3"
val jacksonVersion = "2.16.2"
val cxfVersion = "4.0.5"
val commonsTextVersion = "1.12.0"
val gitbTypesVersion = "1.24.2"
val gitbTypesVersion = "1.24.3"
val bouncyCastleVersion = "1.78.1"

useCoursier := false
Expand Down
18 changes: 9 additions & 9 deletions gitb-ui/project/owasp-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,18 @@
<packageUrl regex="true">^pkg:maven/org\.glassfish\.jaxb/txw2@.*$</packageUrl>
<cve>CVE-2024-9329</cve>
</suppress>
<suppress>
<notes><![CDATA[
file name: org.eclipse.jetty.jetty-http-11.0.22.jar
]]></notes>
<packageUrl regex="true">^pkg:maven/org\.eclipse\.jetty/jetty-http@.*$</packageUrl>
<vulnerabilityName>CVE-2024-6763</vulnerabilityName>
</suppress>
<suppress>
<notes><![CDATA[
file name: org.eclipse.jetty.jetty-server-11.0.22.jar
]]></notes>
<packageUrl regex="true">^pkg:maven/org\.eclipse\.jetty/jetty-server@.*$</packageUrl>
<packageUrl regex="true">^pkg:maven/org\.eclipse\.jetty/jetty-.*@.*$</packageUrl>
<vulnerabilityName>CVE-2024-8184</vulnerabilityName>
</suppress>
</suppress>
<suppress>
<notes><![CDATA[
file name: org.eclipse.jetty.jetty-io-11.0.22.jar
]]></notes>
<packageUrl regex="true">^pkg:maven/org\.eclipse\.jetty/jetty-.*@.*$</packageUrl>
<cve>CVE-2024-6763</cve>
</suppress>
</suppressions>
Loading

0 comments on commit 2b5f258

Please sign in to comment.