Skip to content

Commit

Permalink
Reproduce the double patch bump
Browse files Browse the repository at this point in the history
  • Loading branch information
dagguh committed Jun 14, 2024
1 parent e4aeb8c commit b1edd81
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Fixtures {
buildFolder.create()
val git = Git.init().setDirectory(buildFolder.root).call()
addInitialCommit(projectName, buildFolder, git)
git.tag().setName("release-$version-alpha").call()
git.tag().setName("release-$version").call()
addCode(buildFolder, git)
return ProjectFixture(buildFolder.root, git)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.atlassian.performance.tools.license

import com.atlassian.performance.tools.license.Fixtures.ProjectFixture
import org.assertj.core.api.Assertions.assertThat
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.transport.URIish
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.gradle.testkit.runner.TaskOutcome
import org.gradle.testkit.runner.TaskOutcome.SUCCESS
import org.junit.Test
import org.junit.rules.TemporaryFolder

Expand All @@ -23,16 +25,28 @@ class ReleaseTest {
project.git.addOrigin(safelyPushableRemote)
project.git.push().call()

val releaseResult = GradleRunner.create()
.withProjectDir(project.root)
.withArguments("release", "--stacktrace")
val markNextVersion = project.buildTask(
"markNextVersion",
"-Prelease.incrementer=incrementPatch",
"-Prelease.localOnly",
"--stacktrace"
)
assertThat(markNextVersion?.task(":markNextVersion")?.outcome).isEqualTo(SUCCESS)

val release = project.buildTask("release", "--stacktrace")
assertThat(release?.task(":release")?.outcome).isEqualTo(SUCCESS)

val currentVersion = project.buildTask("currentVersion")
assertThat(currentVersion?.output).contains("1.2.5")
}

private fun ProjectFixture.buildTask(task: String, vararg args: String): BuildResult? {
return GradleRunner.create()
.withProjectDir(this.root)
.withArguments(task, *args)
.withPluginClasspath()
.forwardOutput()
.withDebug(true)
.build()

val releaseTask = releaseResult.task(":release")
assertThat(releaseTask?.outcome)
.isEqualTo(TaskOutcome.SUCCESS)
}
}

0 comments on commit b1edd81

Please sign in to comment.