Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test methods for versionless feature on older runtime #907

Merged
merged 3 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading