davsclaus commented on code in PR #31326: URL: https://github.com/apache/camel/pull/31326#discussion_r4788698925
########## components/camel-robotframework/src/test/java/org/apache/camel/component/robotframework/RobotFrameworkInterruptedRunTest.java: ########## @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.robotframework; + +import java.util.Arrays; +import java.util.concurrent.TimeUnit; + +import org.apache.camel.Exchange; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.test.junit6.CamelTestSupport; +import org.junit.jupiter.api.Test; + +import static org.awaitility.Awaitility.await; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +/** + * A Robot Framework run that is interrupted must not break the later runs in the same JVM: the console stream of Robot + * Framework is shared by the JVM and, with the console enabled, it stays closed after the interrupt. + */ +class RobotFrameworkInterruptedRunTest extends CamelTestSupport { + + @Test + void testRunAfterInterruptedRunSucceeds() throws Exception { + template.send("direct:robot", e -> e.getIn().setBody("warmup")); + + // a thread that is interrupted while Robot Framework starts closes the console stream of Robot Framework + for (int i = 0; i < 5; i++) { + Thread interrupted = new Thread(() -> template.send("direct:robot", e -> e.getIn().setBody("interrupted"))); + interrupted.start(); + await().atMost(30, TimeUnit.SECONDS) + .until(() -> !interrupted.isAlive() || Arrays.stream(interrupted.getStackTrace()) + .anyMatch(frame -> frame.getClassName().startsWith("org.python."))); + interrupted.interrupt(); Review Comment: Addressed by 631be4c: each Robot test class now writes to its own output directory, so the forks no longer share `target/output.xml`, and this test waits with Awaitility (30 s). Resolving. _Claude Code on behalf of davsclaus_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
