Skip to content

Commit

Permalink
add test for failed push
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny Ranson committed Dec 16, 2024
1 parent 326e4a3 commit f0d5eaf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,7 @@ As always, use the `--repos` flag to specify an alternative repo file to the def

```turbolift update-prs --close [--yes]```
```turbolift update-prs --push [--yes]```
```turbolift update-prs --amend-description [--yes]```
```turblift update-prs --amend-description --description prDescriptionFile1.md```
```turbolift update-prs --amend-description [--description prDescriptionFile1.md] [--yes]```

Note that when updating PR descriptions, as when creating PRs, the `--description` flag can be used to specify an
alternative description file to the default `README.md`.
Expand Down
21 changes: 21 additions & 0 deletions cmd/updateprs/updateprs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,27 @@ func TestItPushesNewCommits(t *testing.T) {
})
}

func TestItLogsPushErrorsButContinuesToTryAll(t *testing.T) {
fakeGitHub := github.NewAlwaysSucceedsFakeGitHub()
gh = fakeGitHub
fakeGit := git.NewAlwaysFailsFakeGit()
g = fakeGit

tempDir := testsupport.PrepareTempCampaign(true, "org/repo1", "org/repo2")

out, err := runPushCommandAuto()
assert.NoError(t, err)
assert.Contains(t, out, "Pushing changes in org/repo1 to origin")
assert.Contains(t, out, "Pushing changes in org/repo2 to origin")
assert.Contains(t, out, "turbolift update-prs completed with errors")
assert.Contains(t, out, "2 errored")

fakeGit.AssertCalledWith(t, [][]string{
{"push", "work/org/repo1", filepath.Base(tempDir)},
{"push", "work/org/repo2", filepath.Base(tempDir)},
})
}

func TestItDoesNotPushIfNotConfirmed(t *testing.T) {
fakeGitHub := github.NewAlwaysSucceedsFakeGitHub()
gh = fakeGitHub
Expand Down

0 comments on commit f0d5eaf

Please sign in to comment.