From f0d5eaf39beae5451e787e6ba34626a01f9f981b Mon Sep 17 00:00:00 2001 From: Danny Ranson Date: Mon, 16 Dec 2024 15:18:42 +0000 Subject: [PATCH] add test for failed push --- README.md | 3 +-- cmd/updateprs/updateprs_test.go | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8636968..d1c4d03 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/cmd/updateprs/updateprs_test.go b/cmd/updateprs/updateprs_test.go index 005f46c..01485c3 100644 --- a/cmd/updateprs/updateprs_test.go +++ b/cmd/updateprs/updateprs_test.go @@ -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