Skip to content

Commit

Permalink
Add separate test for STRICT Lockmode
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Apr 6, 2024
1 parent 5508e99 commit 132421a
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.gradle.github.dependencygraph

import org.gradle.test.fixtures.PluginPublisher
import org.gradle.test.fixtures.maven.MavenModule
import org.gradle.util.GradleVersion
import spock.lang.IgnoreIf

class DependencyLockingDependencyExtractorTest extends BaseExtractorTest {
Expand Down Expand Up @@ -36,6 +37,41 @@ class DependencyLockingDependencyExtractorTest extends BaseExtractorTest {
implementation "org.test:foo:+"
}
dependencyLocking {
lockAllConfigurations()
}
"""

// Write dependency lock file
run("dependencies", "--write-locks")
mavenRepo.module("org.test", "foo", "1.1").publish()

when:
applyDependencyGraphPlugin()
run()

then:
def manifest = gitHubManifest()
manifest.sourceFile == "settings.gradle"

manifest.assertResolved([
"org.test:foo:1.0": [
package_url: purlFor(foo)
]
])
}

@IgnoreIf({
// `LockMode.STRICT` was introduced in Gradle 6.1
GradleVersion.version(testGradleVersion) < GradleVersion.version("6.1")
})
def "extracts dependencies when Strict dependency locking is enabled"() {
given:
buildFile << """
dependencies {
implementation "org.test:foo:+"
}
dependencyLocking {
lockAllConfigurations()
lockMode = LockMode.STRICT
Expand Down

0 comments on commit 132421a

Please sign in to comment.