Skip to content

Commit a021d14

Browse files
committed
fix: issues
1 parent 83f398b commit a021d14

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

internal/librarianops/generate.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ func createGithubDetails(repoName string) GithubDetails {
176176
sources = "googleapis and discovery-artifact-manager"
177177
}
178178
title := fmt.Sprintf("chore: update %s and regenerate", sources)
179-
body := fmt.Sprintf(`
180-
Update %s to the latest commit and regenerate all client libraries.`, sources)
179+
body := fmt.Sprintf("Update %s to the latest commit and regenerate all client libraries.", sources)
181180
return GithubDetails{
182181
PrTitle: title,
183182
PrBody: body,

internal/librarianops/github_utils_test.go

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ func formatCmd(name string, args ...string) string {
4747
}
4848

4949
func TestUploadToGithub(t *testing.T) {
50-
t.Parallel()
5150

5251
for _, test := range []struct {
5352
name string
@@ -108,7 +107,6 @@ func TestUploadToGithub(t *testing.T) {
108107
}
109108

110109
func TestUploadToGithub_Error(t *testing.T) {
111-
t.Parallel()
112110
const (
113111
branch = "fix-branch"
114112
title = "fix: bug"
@@ -117,7 +115,6 @@ func TestUploadToGithub_Error(t *testing.T) {
117115
for _, test := range []struct {
118116
name string
119117
wantResults map[string]error
120-
wantErr string
121118
}{
122119
{
123120
name: "branch creation fails",
@@ -161,15 +158,11 @@ func TestUploadToGithub_Error(t *testing.T) {
161158
if err == nil {
162159
t.Error("expected error, got nil")
163160
}
164-
if !strings.Contains(err.Error(), test.wantErr) {
165-
t.Errorf("error %q does not contain expected string %q", err, test.wantErr)
166-
}
167161
})
168162
}
169163
}
170164

171165
func TestCloneRepoInDir(t *testing.T) {
172-
t.Parallel()
173166
const (
174167
repoName = "librarian"
175168
repoDir = "/tmp/repo"
@@ -187,7 +180,6 @@ func TestCloneRepoInDir(t *testing.T) {
187180
}
188181

189182
func TestCloneRepoInDir_Error(t *testing.T) {
190-
t.Parallel()
191183
for _, test := range []struct {
192184
name string
193185
wantErr error
@@ -207,7 +199,6 @@ func TestCloneRepoInDir_Error(t *testing.T) {
207199
}
208200

209201
func TestCreateBranch(t *testing.T) {
210-
t.Parallel()
211202
for _, test := range []struct {
212203
name string
213204
branch string
@@ -232,7 +223,6 @@ func TestCreateBranch(t *testing.T) {
232223
}
233224

234225
func TestCreateBranch_Error(t *testing.T) {
235-
t.Parallel()
236226
for _, test := range []struct {
237227
name string
238228
wantErr error
@@ -282,29 +272,29 @@ func TestCommitChanges_Error(t *testing.T) {
282272
for _, test := range []struct {
283273
name string
284274
wantResults map[string]error
285-
wantErr string
275+
wantErr error
286276
}{
287277
{
288278
name: "add fails",
289279
wantResults: map[string]error{
290280
formatCmd("git", "add", "."): fmt.Errorf("add fail"),
291281
},
292-
wantErr: "add fail",
282+
wantErr: fmt.Errorf("add fail"),
293283
},
294284
{
295285
name: "commit fails",
296286
wantResults: map[string]error{
297287
formatCmd("git", "add", "."): nil,
298288
formatCmd("git", "commit", "-m", "msg"): fmt.Errorf("commit fail"),
299289
},
300-
wantErr: "commit fail",
290+
wantErr: fmt.Errorf("commit fail"),
301291
},
302292
} {
303293
t.Run(test.name, func(t *testing.T) {
304294
testRun, _ := testRunCommand(test.wantResults, nil)
305295
runCommand = testRun
306296
err := commitChanges(context.Background(), "msg")
307-
if err == nil || !strings.Contains(err.Error(), test.wantErr) {
297+
if err == nil || !strings.Contains(err.Error(), test.wantErr.Error()) {
308298
t.Errorf("got error %v, want %q", err, test.wantErr)
309299
}
310300
})

0 commit comments

Comments
 (0)