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

Fix for windows failing test InternalDistributionArchiveCheckPluginFu… #5405

Merged
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

package org.opensearch.gradle.internal

import org.gradle.internal.os.OperatingSystem
import org.opensearch.gradle.VersionProperties
import org.opensearch.gradle.fixtures.AbstractGradleFuncTest
import org.gradle.testkit.runner.TaskOutcome
Expand Down Expand Up @@ -76,11 +77,18 @@ class InternalDistributionArchiveCheckPluginFuncTest extends AbstractGradleFuncT
from 'SomeFile.class'
}
"""
when:
def result = gradleRunner(":darwin-${archiveType}:check", '--stacktrace').buildAndFail()
then:
result.task(":darwin-${archiveType}:checkExtraction").outcome == TaskOutcome.FAILED
result.output.contains("Detected class file in distribution ('SomeFile.class')")
if (OperatingSystem.current() == OperatingSystem.WINDOWS) {
when:
def result = gradleRunner(":darwin-${archiveType}:check", '--stacktrace').build()
then:
result.task(":darwin-${archiveType}:checkExtraction").outcome == TaskOutcome.SKIPPED
} else {
when:
def result = gradleRunner(":darwin-${archiveType}:check", '--stacktrace').buildAndFail()
then:
result.task(":darwin-${archiveType}:checkExtraction").outcome == TaskOutcome.FAILED
result.output.contains("Detected class file in distribution ('SomeFile.class')")
}

where:
archiveType << ["zip", 'tar']
Expand All @@ -102,13 +110,21 @@ Copyright 2009-2018 Acme Coorp"""
}
"""

when:
def result = gradleRunner(":darwin-tar:checkNotice").buildAndFail()
then:
result.task(":darwin-tar:checkNotice").outcome == TaskOutcome.FAILED
normalizedOutput(result.output).contains("> expected line [2] in " +
if (OperatingSystem.current() == OperatingSystem.WINDOWS) {
when:
def result = gradleRunner(":darwin-tar:checkNotice").build()
then:
result.task(":darwin-tar:checkNotice").outcome == TaskOutcome.SKIPPED
} else {
when:
def result = gradleRunner(":darwin-tar:checkNotice").buildAndFail()
then:
result.task(":darwin-tar:checkNotice").outcome == TaskOutcome.FAILED
normalizedOutput(result.output).contains("> expected line [2] in " +
"[./darwin-tar/build/tar-extracted/opensearch-${VersionProperties.getOpenSearch()}/NOTICE.txt] " +
"to be [Copyright OpenSearch Contributors] but was [Copyright 2009-2018 Acme Coorp]")
}

}

void license(File file = file("licenses/APACHE-LICENSE-2.0.txt")) {
Expand Down