Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Flaky Flank-scripts test #1080

Merged
merged 3 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ jobs:
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
slack-channel: flank_test_channel
slack-optional-icon_emoji: ":fire:"
slack-text: <http://github.com/Flank/flank/releases/tag/${{ RELEASE_TAG }}|Flank "${{ RELEASE_TAG }}" > is released \n ${{ RELEASE_NOTES }}
slack-text: <http://github.com/Flank/flank/releases/tag/${{ env.RELEASE_TAG }}|Flank "${{ env.RELEASE_TAG }}" > is released \n ${{ env.RELEASE_NOTES }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package flank.scripts.ci.nexttag

import com.github.kittinunf.result.Result
import com.google.common.truth.Truth.assertThat
import flank.scripts.FuelTestRunner
import flank.scripts.ci.releasenotes.GitHubRelease
import flank.scripts.github.getLatestReleaseTag
import io.mockk.coEvery
import io.mockk.mockkStatic
import org.junit.Rule
import org.junit.Test
import org.junit.contrib.java.lang.system.ExpectedSystemExit
Expand All @@ -21,11 +26,15 @@ class NextReleaseTagCommandTest {

@Test
fun `Should return properly message when success`() {
// when
NextReleaseTagCommand().main(arrayOf("--token=success"))
mockkStatic("flank.scripts.github.GithubApiKt") {
coEvery { getLatestReleaseTag(any()) } returns Result.success(GitHubRelease("v20.09.0"))

// when
NextReleaseTagCommand().main(arrayOf("--token=success"))

// then
assertThat(systemOutRule.log).contains("v20.08.1")
// expected
assertThat(systemOutRule.log).contains("v20.09.1")
}
}

@Test
Expand All @@ -35,7 +44,6 @@ class NextReleaseTagCommandTest {
systemExit.checkAssertionAfterwards {
assertThat(systemOutRule.log).contains("Error while doing GitHub request")
}

// when
NextReleaseTagCommand().main(arrayOf("--token=failure"))
}
Expand Down