Skip to content

Commit

Permalink
Enable configuration cache for locking related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rpalcolea committed Nov 11, 2023
1 parent a8ef787 commit 60fba75
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 130 deletions.
10 changes: 10 additions & 0 deletions src/test/groovy/nebula/plugin/BaseIntegrationTestKitSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import nebula.test.IntegrationTestKitSpec

abstract class BaseIntegrationTestKitSpec extends IntegrationTestKitSpec {
def setup() {
// Enable configuration cache :)
new File(projectDir, 'gradle.properties') << '''org.gradle.configuration-cache=true'''.stripIndent()
}

void disableConfigurationCache() {
def propertiesFile = new File(projectDir, 'gradle.properties')
if(propertiesFile.exists()) {
propertiesFile.delete()
}
propertiesFile.createNewFile()
propertiesFile << '''org.gradle.configuration-cache=false'''.stripIndent()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class DependencyLockAlignmentLauncherSpec extends BaseIntegrationTestKitSpec {
def setup() {
definePluginOutsideOfPluginBlock = true
keepFiles = true

//TODO make task listener changes for config cache
disableConfigurationCache()
}

@Unroll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package nebula.plugin.dependencylock

import nebula.plugin.BaseIntegrationTestKitSpec
import nebula.plugin.dependencylock.dependencyfixture.Fixture
import nebula.test.IntegrationTestKitSpec
import org.ajoberstar.grgit.Grgit

import java.nio.file.Files

class DependencyLockCommitLauncherSpec extends BaseIntegrationTestKitSpec {
class DependencyLockCommitLauncherSpec extends IntegrationTestKitSpec {

protected Grgit git
protected Grgit originGit
Expand Down Expand Up @@ -53,7 +53,6 @@ class DependencyLockCommitLauncherSpec extends BaseIntegrationTestKitSpec {
build/
gradle.properties'''.stripIndent()
def gradleProperties = new File(projectDir, "gradle.properties")
gradleProperties.createNewFile()
gradleProperties << "systemProp.nebula.features.coreLockingSupport=false"
// Enable configuration cache :)
gradleProperties << '''org.gradle.configuration-cache=true'''.stripIndent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import nebula.plugin.BaseIntegrationTestKitSpec
import nebula.plugin.dependencylock.dependencyfixture.Fixture
import nebula.plugin.dependencylock.util.LockGenerator
import nebula.plugin.dependencylock.utils.GradleVersionUtils
import nebula.test.IntegrationTestKitSpec
import nebula.test.dependencies.DependencyGraphBuilder
import nebula.test.dependencies.GradleDependencyGenerator
import nebula.test.dependencies.ModuleBuilder
Expand Down Expand Up @@ -446,6 +445,9 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec {
dependenciesLock << PRE_DIFF_FOO_LOCK
buildFile << BUILD_GRADLE

//TODO make diff lock config cache compatible
disableConfigurationCache()

when:
runTasks('generateLock', 'diffLock')

Expand Down Expand Up @@ -1056,6 +1058,8 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec {
}
'''.stripIndent())

//TODO make diff lock config cache compatible
disableConfigurationCache()
when:
runTasks('generateLock', 'diffLock')

Expand All @@ -1071,6 +1075,8 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec {
}

def 'diffLock in multiproject with no locks'() {
//TODO make diff lock config cache compatible
disableConfigurationCache()
setupCommonMultiproject()

when:
Expand Down
Loading

0 comments on commit 60fba75

Please sign in to comment.