From 2bd35e1482a65d21ec7a1f337a813c897baf648b Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 16 Oct 2024 21:35:48 +0530 Subject: [PATCH] fixing windows test issues Signed-off-by: Arun Venmany --- .github/workflows/gradle.yml | 4 ++-- .../openliberty/tools/gradle/tasks/DevTask.groovy | 12 ++---------- .../gradle/TestMultiModuleLooseEarWithPages.groovy | 14 +++++++------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f5797de1..7e3d03fd 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -154,13 +154,13 @@ jobs: - name: Run tests that require a minimum of Java 17 or later if: ${{ matrix.java == '17' || matrix.java == '21' }} run: - ./gradlew clean install check -P"test.include"="**/TestSpringBootApplication30*,**/TestCompileJSPSource17*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info --no-daemon + ./gradlew clean install check -P"test.include"="**/TestSpringBootApplication30*,**/TestCompileJSPSource17*,**/TestMultiModuleLooseEarWithPages*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info --no-daemon # Run tests - name: Run tests with Gradle on Windows working-directory: C:/ci.gradle # LibertyTest is excluded because test0_run hangs # For Java 8, TestCreateWithConfigDir is excluded because test_micro_clean_liberty_plugin_variable_config runs out of memory - run: ./gradlew clean install check -P"test.exclude"="${{env.TEST_EXCLUDE}}" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info --no-daemon + run: ./gradlew clean install check -P"test.include"="**" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info --no-daemon timeout-minutes: 75 # Copy build reports and upload artifact if build failed - name: Copy build/report/tests/test for upload diff --git a/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy b/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy index 4d5687e5..938d04cc 100644 --- a/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy +++ b/src/main/groovy/io/openliberty/tools/gradle/tasks/DevTask.groovy @@ -371,7 +371,6 @@ class DevTask extends AbstractFeatureTask { Map libertyDirPropertyFiles = new HashMap (); private ServerTask serverTask = null; - Set upstreamGradleProjects; DevTaskUtil(File buildDir, File installDirectory, File userDirectory, File serverDirectory, File sourceDirectory, File testSourceDirectory, File configDirectory, File projectDirectory, List resourceDirs, boolean changeOnDemandTestsAction, boolean hotTests, boolean skipTests, boolean skipInstallFeature, String artifactId, int serverStartTimeout, @@ -379,7 +378,7 @@ class DevTask extends AbstractFeatureTask { boolean libertyDebug, boolean pollingTest, boolean container, File containerfile, File containerBuildContext, String containerRunOpts, int containerBuildTimeout, boolean skipDefaultPorts, boolean keepTempContainerfile, String mavenCacheLocation, String packagingType, File buildFile, boolean generateFeatures, List webResourceDirs, - List projectModuleList, Set gradleProjects + List projectModuleList ) throws IOException, PluginExecutionException { super(buildDir, serverDirectory, sourceDirectory, testSourceDirectory, configDirectory, projectDirectory, /* multi module project directory */ projectDirectory, resourceDirs, changeOnDemandTestsAction, hotTests, skipTests, false /* skipUTs */, false /* skipITs */, skipInstallFeature, artifactId, serverStartTimeout, @@ -388,7 +387,6 @@ class DevTask extends AbstractFeatureTask { null /* compileOptions not needed since useBuildRecompile is true */, keepTempContainerfile, mavenCacheLocation, projectModuleList /* multi module upstream projects */, false /* recompileDependencies only supported in ci.maven */, packagingType, buildFile, null /* parent build files */, generateFeatures, null /* compileArtifactPaths */, null /* testArtifactPaths */, webResourceDirs /* webResources */ ); - this.upstreamGradleProjects = gradleProjects; this.libertyDirPropertyFiles = AbstractServerTask.getLibertyDirectoryPropertyFiles(installDirectory, userDirectory, serverDirectory); ServerFeatureUtil servUtil = getServerFeatureUtil(true, libertyDirPropertyFiles); FeaturesPlatforms fp = servUtil.getServerFeatures(serverDirectory, libertyDirPropertyFiles); @@ -1216,10 +1214,6 @@ class DevTask extends AbstractFeatureTask { @TaskAction void action() { - //all projects contain list of all gradle projects. - // this list of projects is passed to DevTaskUtil constructor - // to be used for recompileBuildFile, updateArtifcatPaths etc - Set allProjects = new HashSet() initializeDefaultValues(); SourceSet mainSourceSet = project.sourceSets.main; @@ -1272,8 +1266,6 @@ class DevTask extends AbstractFeatureTask { // Project modules contain all child modules. This project modules will be present only for multi-module // used to watch sub project src and test source files List projectModules = getProjectModules() - allProjects.add(project) - allProjects.addAll(DevTaskHelper.getAllUpstreamProjects(project)) try { this.util = new DevTaskUtil(project.getLayout().getBuildDirectory().getAsFile().get(), serverInstallDir, getUserDir(project, serverInstallDir), serverDirectory, sourceDirectory, testSourceDirectory, configDirectory, project.getRootDir(), @@ -1281,7 +1273,7 @@ class DevTask extends AbstractFeatureTask { verifyAppStartTimeout.intValue(), verifyAppStartTimeout.intValue(), compileWait.doubleValue(), libertyDebug.booleanValue(), pollingTest.booleanValue(), container.booleanValue(), containerfile, containerBuildContext, containerRunOpts, containerBuildTimeout, skipDefaultPorts.booleanValue(), keepTempContainerfile.booleanValue(), localMavenRepoForFeatureUtility, - DevTaskHelper.getPackagingType(project), buildFile, generateFeatures.booleanValue(), webResourceDirs, projectModules, allProjects + DevTaskHelper.getPackagingType(project), buildFile, generateFeatures.booleanValue(), webResourceDirs, projectModules ); } catch (IOException | PluginExecutionException e) { throw new GradleException("Error initializing dev mode.", e) diff --git a/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarWithPages.groovy b/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarWithPages.groovy index 859cb9df..afbcacb7 100644 --- a/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarWithPages.groovy +++ b/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarWithPages.groovy @@ -90,14 +90,14 @@ public class TestMultiModuleLooseEarWithPages extends AbstractIntegrationTest{ nodes = (NodeList) xPath.compile(expression).evaluate(inputDoc, XPathConstants.NODESET); Assert.assertEquals("Number of element ==>", 2, nodes.getLength()); if (OSUtil.isWindows()) { - ejbWar = "//ejb-war-1.0-SNAPSHOT.war" - warWebappsFolder = "//multi-module-loose-ear-pages-test//war//src//main//webapp" - ejbJar = "//WEB-INF//lib//ejb-jar-1.0-SNAPSHOT.jar" + ejbWar = "\\ejb-war-1.0-SNAPSHOT.war" + warWebappsFolder = "\\multi-module-loose-ear-pages-test\\war\\src\\main\\webapp" + ejbJar = "\\WEB-INF\\lib\\ejb-jar-1.0-SNAPSHOT.jar" } - Assert.assertTrue(List.of(nodes.item(0).getAttributes() - .getNamedItem("targetInArchive").getNodeValue(), - nodes.item(0).getAttributes() - .getNamedItem("targetInArchive").getNodeValue()).contains(ejbWar)) + Assert.assertTrue(nodes.item(0).getAttributes() + .getNamedItem("targetInArchive").getNodeValue().equals(ejbWar)|| + nodes.item(1).getAttributes() + .getNamedItem("targetInArchive").getNodeValue().equals(ejbWar)) expression = "/archive/archive/dir"; nodes = (NodeList) xPath.compile(expression).evaluate(inputDoc, XPathConstants.NODESET);