Skip to content

Commit

Permalink
fix for InternalDistributionArchiveCheckPluginFuncTest failure on win…
Browse files Browse the repository at this point in the history
…dows (#5401)

Signed-off-by: Poojita Raj <poojiraj@amazon.com>

Signed-off-by: Poojita Raj <poojiraj@amazon.com>
  • Loading branch information
Poojita-Raj committed Nov 29, 2022
1 parent 9d51542 commit c0b5237
Showing 1 changed file with 26 additions and 10 deletions.
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

0 comments on commit c0b5237

Please sign in to comment.