Skip to content

Commit

Permalink
Add test methods for versionless feature on older runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
cherylking committed Sep 13, 2024
1 parent 1bd05b9 commit 519657e
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
- name: Checkout ci.common
uses: actions/checkout@v3
with:
repository: OpenLiberty/ci.common
repository: cherylking/ci.common
ref: checkRuntimeForVersionlessFeature
path: ci.common
- name: Checkout ci.ant
uses: actions/checkout@v3
Expand Down Expand Up @@ -124,7 +125,7 @@ jobs:
- name: Clone ci.ant, ci.common, ci.gradle repos to C drive
run: |
cp -r D:/a/ci.gradle/ci.gradle C:/ci.gradle
git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common
git clone https://github.com/cherylking/ci.common.git --branch checkRuntimeForVersionlessFeature --single-branch C:/ci.common
git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant
# Cache mvn/gradle packages
- name: Cache Maven packages
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ compileTestGroovy {
targetCompatibility = JavaVersion.VERSION_1_8
}

def libertyAntVersion = "1.9.15"
def libertyAntVersion = "1.9.16-SNAPSHOT"
def libertyCommonVersion = "1.8.34-SNAPSHOT"

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,39 @@ class KernelInstallVersionlessFeatureTest extends AbstractIntegrationTest{
assertTrue(output.contains("CWWKF1516E: The platform could not be determined. The following versionless features cannot be installed: [ejb]."))
}

@Test
/**
* Install with only server.xml features
*/
public void testInstallVersionedFeatureWithPlatformServerOldRelease() {
copyBuildFiles(new File(resourceDir, "install_features_server_old_release.gradle"), buildDir)
runTasks(buildDir, "libertyCreate")
copyServer("server_versioned_feature_with_platform.xml")
// expect failure - check for error message
BuildResult result = runTasksFailResult(buildDir, "installFeature")
String output = result.getOutput()
assertTrue(output.contains("PluginExecutionException: Detected versionless feature(s) for installation. The minimum required Liberty version for versionless feature support is 24.0.0.8"))
}

@Test
/**
* Install with only server.xml features
*/
public void testInstallVersionlessFeaturesNoPlatformServerOldRelease() {
copyBuildFiles(new File(resourceDir, "install_features_server_old_release.gradle"), buildDir)
runTasks(buildDir, "libertyCreate")
copyServer("server_versionless_feature_no_platform.xml")
// expect failure - check for error message
BuildResult result = runTasksFailResult(buildDir, "installFeature")
String output = result.getOutput()
assertTrue(output.contains("Detected possible versionless feature(s) for installation. The minimum required Liberty version for versionless feature support is 24.0.0.8"))
assertTrue(output.contains("PluginExecutionException: CWWKF1299E: The following features could not be obtained: ejb. Ensure that the features are valid for Open Liberty."))
}

//@Test
// Commented out because current failure returns
// "Cannot invoke "com.ibm.ws.kernel.feature.provisioning.ProvisioningFeatureDefinition.getSymbolicName()" because the return value of "java.util.HashMap.get(Object)" is null"
// Opened issue https://github.com/OpenLiberty/ci.common/issues/452 to follow up.
/**
* Install with only server.xml features
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
name = 'Sonatype Nexus Snapshots'
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
classpath "io.openliberty.tools:liberty-gradle-plugin:$lgpVersion"
}
}

apply plugin: 'liberty'

repositories {
mavenCentral()
}

dependencies {
// Runtime set to older version on purpose before versionless feature support was added
libertyRuntime group: runtimeGroup, name: kernelArtifactId, version: '24.0.0.6'
}

liberty {
server{
features {
acceptLicense = true
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<server description="default server">
<featureManager>
<feature>servlet-4.0</feature>
<platform>javaee-8.0</platform>
</featureManager>
</server>

0 comments on commit 519657e

Please sign in to comment.