Skip to content

Commit

Permalink
Fixes #4603 - Fix SnoopIT test (#4604)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem authored Feb 21, 2025
1 parent bcff672 commit 26162e8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tck-coreprofile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ jobs:
result:
if: ${{ always() }} && github.repository == 'piranhacloud/piranha'
runs-on: ubuntu-latest
needs: [annotations, coreprofile, inject, jsonb, jsonp, rest]
needs: [annotations, cdi, coreprofile, inject, jsonb, jsonp, rest]
steps:
- name: Check build results
run: |
Expand Down
22 changes: 16 additions & 6 deletions test/micro/snoop/src/test/java/snoop/SnoopIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@
import org.junit.jupiter.api.AfterEach;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.File;
import java.time.Duration;

import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlPage;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import cloud.piranha.test.common.PiranhaStartup;
import me.alexpanov.net.FreePortFinder;

/**
* The integration tests for the Snoop web application.
*
Expand All @@ -50,6 +55,11 @@ public class SnoopIT {
*/
private static int port;

/**
* Stores the process.
*/
private static Process process;

/**
* Stores the web client.
*/
Expand All @@ -60,7 +70,7 @@ public class SnoopIT {
*/
@AfterAll
public static void afterAll() {
// process.destroyForcibly();
process.destroyForcibly();
}

/**
Expand All @@ -78,7 +88,6 @@ public void afterEach() {
*/
@BeforeAll
public static void beforeAll() throws Exception {
/*
port = FreePortFinder.findFreeLocalPort();
process = new ProcessBuilder()
.directory(new File("target"))
Expand All @@ -88,11 +97,12 @@ public static void beforeAll() throws Exception {
"--http-port",
String.valueOf(port),
"--war-file",
"snoop.war")
"snoop.war",
"--verbose")
.inheritIO()
.start();

PiranhaStartup.waitUntilPiranhaReady(process, port);
*/
}

/**
Expand All @@ -108,9 +118,9 @@ public void beforeEach() {
*
* @throws Exception when a serious error occurs.
*/
@Disabled
@Test
public void testSnoop() throws Exception {
Thread.sleep(Duration.ofSeconds(5));
HtmlPage page = webClient.getPage("http://localhost:" + port + "/Snoop");
assertTrue(page.asXml().contains("Snoop"));
}
Expand Down
11 changes: 4 additions & 7 deletions test/tck/coreprofile/cdi/runner/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<artifactId>core</artifactId>
<name>Piranha - Test - TCK - Core Profile - CDI TCK - Runner - Core</name>
<properties>
<testng.version>7.10.2</testng.version>
<testng.version>7.9.0</testng.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -51,6 +51,7 @@
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core-impl</artifactId>
<version>${weld.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
Expand Down Expand Up @@ -200,7 +201,6 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!--
Expand All @@ -216,7 +216,6 @@
<compilerArgument>-Xlint:unchecked</compilerArgument>
</configuration>
</plugin>

<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
Expand Down Expand Up @@ -280,8 +279,7 @@
<goal>test-jar</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/dependency/lib</outputDirectory>
<outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
<archive>
<manifest>
<addClasspath>false</addClasspath>
Expand Down Expand Up @@ -327,8 +325,7 @@
<reuseForks>false</reuseForks>
<systemPropertyVariables>
<piranha.jvmArguments>-ea</piranha.jvmArguments>
<org.jboss.cdi.tck.libraryDirectory>
${project.build.directory}/dependency/lib</org.jboss.cdi.tck.libraryDirectory>
<org.jboss.cdi.tck.libraryDirectory>${project.build.directory}/dependency/lib</org.jboss.cdi.tck.libraryDirectory>
</systemPropertyVariables>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
Expand Down

0 comments on commit 26162e8

Please sign in to comment.