-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some extra tests for dependency mutation
- Loading branch information
Showing
7 changed files
with
107 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...t/groovy/org/gradle/profiler/mutations/ApplyDependencyChangeMutatorIntegrationTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package org.gradle.profiler.mutations | ||
|
||
import org.gradle.profiler.AbstractProfilerIntegrationTest | ||
import org.gradle.profiler.Main | ||
|
||
class ApplyDependencyChangeMutatorIntegrationTest extends AbstractProfilerIntegrationTest { | ||
|
||
def "successfully benchmarks gradle projects with dependency mutations with default values"() { | ||
given: | ||
instrumentedBuildScript() | ||
println buildFile | ||
def scenarioFile = file("performance.scenarios") << """ | ||
s1 { | ||
tasks = assemble | ||
apply-dependency-change-to { | ||
files = ["build.gradle"] | ||
} | ||
} | ||
""" | ||
|
||
when: | ||
new Main().run("--project-dir", projectDir.absolutePath, "--output-dir", outputDir.absolutePath, "--gradle-version", latestSupportedGradleVersion, "--scenario-file", scenarioFile.absolutePath, "--benchmark", "s1") | ||
|
||
then: | ||
resultFile.containsWarmDaemonScenario(latestSupportedGradleVersion, "s1", ["assemble"]) | ||
} | ||
|
||
def "successfully benchmarks gradle projects with dependency mutations"() { | ||
given: | ||
instrumentedBuildScript() | ||
println buildFile | ||
def scenarioFile = file("performance.scenarios") << """ | ||
s1 { | ||
tasks = assemble | ||
apply-dependency-change-to { | ||
files = ["build.gradle"] | ||
projects-set-size = 2 | ||
applied-projects-size = 1 | ||
} | ||
} | ||
""" | ||
|
||
when: | ||
new Main().run("--project-dir", projectDir.absolutePath, "--output-dir", outputDir.absolutePath, "--gradle-version", latestSupportedGradleVersion, "--scenario-file", scenarioFile.absolutePath, "--benchmark", "s1") | ||
|
||
then: | ||
resultFile.containsWarmDaemonScenario(latestSupportedGradleVersion, "s1", ["assemble"]) | ||
} | ||
|
||
def "fails benchmarks gradle projects if projects set size is less than applied projects size"() { | ||
given: | ||
instrumentedBuildScript() | ||
println buildFile | ||
def scenarioFile = file("performance.scenarios") << """ | ||
s1 { | ||
tasks = assemble | ||
apply-dependency-change-to { | ||
files = ["build.gradle"] | ||
projects-set-size = 2 | ||
applied-projects-size = 3 | ||
} | ||
} | ||
""" | ||
|
||
when: | ||
new Main().run("--project-dir", projectDir.absolutePath, "--output-dir", outputDir.absolutePath, "--gradle-version", latestSupportedGradleVersion, "--scenario-file", scenarioFile.absolutePath, "--benchmark", "s1") | ||
|
||
then: | ||
def e = thrown(IllegalArgumentException) | ||
e.message == "Projects-set-size should be at least equal to applied-project-size." | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/test/groovy/org/gradle/profiler/mutations/support/ProjectCombinationsSupportTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.gradle.profiler.mutations.support | ||
|
||
import spock.lang.Specification | ||
|
||
class ProjectCombinationsSupportTest extends Specification { | ||
|
||
def "creates combinations for given number of projects"() { | ||
when: | ||
def combinations = ProjectCombinationsSupport.createProjectCombinations(3, 2) | ||
|
||
then: | ||
def salt = combinations.getSalt() | ||
combinations.nextCombination == ["project-$salt-0", "project-$salt-1"] as Set<String> | ||
combinations.nextCombination == ["project-$salt-0", "project-$salt-2"] as Set<String> | ||
combinations.nextCombination == ["project-$salt-1", "project-$salt-2"] as Set<String> | ||
// Combinations repeats circular | ||
combinations.nextCombination == ["project-$salt-0", "project-$salt-1"] as Set<String> | ||
combinations.nextCombination == ["project-$salt-0", "project-$salt-2"] as Set<String> | ||
combinations.nextCombination == ["project-$salt-1", "project-$salt-2"] as Set<String> | ||
} | ||
|
||
} |