Skip to content

Commit

Permalink
Fix central cache tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
marchermans committed Jun 1, 2024
1 parent 42cd15b commit 58c777a
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class CentralCacheTests extends BuilderBasedTestSpecification {

def "clean_cache_listens_to_project_property_for_size"() {
given:
File cacheDir;
def project = create("build_supports_configuration_cache_build", {
it.build("""
java {
Expand All @@ -60,18 +61,22 @@ class CentralCacheTests extends BuilderBasedTestSpecification {
}
""")
it.withToolchains()
it.withGlobalCacheDirectory(tempDir)
cacheDir = it.withGlobalCacheDirectory(tempDir)
it.property(CentralCacheService.MAX_CACHE_SIZE_PROPERTY, "4")
})

if (cacheDir == null) {
throw new IllegalStateException("Cache directory was not set")
}

when:
def run = project.run {
it.tasks('build')
}

then:
run.task(':build').outcome == TaskOutcome.SUCCESS
new File(tempDir, ".caches-global").listFiles().size() > 4
cacheDir.listFiles().size() > 4

when:
def cleanRun = project.run {
Expand All @@ -81,7 +86,7 @@ class CentralCacheTests extends BuilderBasedTestSpecification {
then:
cleanRun.task(':clean').outcome == TaskOutcome.SUCCESS
cleanRun.task(':cleanCache').outcome == TaskOutcome.SUCCESS
new File(tempDir, ".caches-global").listFiles().size() == 4
cacheDir.listFiles().size() == 4
}

def "cache_supports_running_gradle_in_parallel"() {
Expand Down

0 comments on commit 58c777a

Please sign in to comment.