зеркало из https://github.com/golang/build.git
internal/task: use existing github pointer helpers
The github package API already provides helpers for creating pointers. Use them as is instead of creating more helpers. Change-Id: Ie4d5031d6c30dec116e5c1ffd2f457fb731c2067 Reviewed-on: https://go-review.googlesource.com/c/build/+/606315 Reviewed-by: Hongxiang Jiang <hxjiang@golang.org> Auto-Submit: Hongxiang Jiang <hxjiang@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Commit-Queue: Hongxiang Jiang <hxjiang@golang.org>
This commit is contained in:
Родитель
73e39f56a2
Коммит
5b502e190a
|
@ -963,7 +963,7 @@ func (f *FakeGitHub) CreateIssue(ctx context.Context, owner string, repo string,
|
|||
if _, ok := f.Milestones[*request.Milestone]; !ok {
|
||||
return nil, nil, fmt.Errorf("the milestone does not exist: %v", *request.Milestone)
|
||||
}
|
||||
f.Issues[issueNumber].Milestone = &github.Milestone{ID: pointTo(int64(*request.Milestone))}
|
||||
f.Issues[issueNumber].Milestone = &github.Milestone{ID: github.Int64(int64(*request.Milestone))}
|
||||
}
|
||||
return f.GetIssue(ctx, owner, repo, issueNumber)
|
||||
}
|
||||
|
@ -986,8 +986,3 @@ func (f *FakeGitHub) PostComment(_ context.Context, _ githubv4.ID, _ string) err
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func pointTo[T any](i T) *T {
|
||||
a := i
|
||||
return &a
|
||||
}
|
||||
|
|
|
@ -29,37 +29,37 @@ func TestCheckBlockers(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
name: "beta 1 with one hard blocker",
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: pointTo("release-blocker")}}, Milestone: &github.Milestone{ID: pointTo(int64(1))}}},
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: github.String("release-blocker")}}, Milestone: &github.Milestone{ID: github.Int64(1)}}},
|
||||
version: "go1.20beta1", kind: KindBeta,
|
||||
want: errManualApproval,
|
||||
},
|
||||
{
|
||||
name: "beta 1 with one blocker marked okay-after-beta1",
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: pointTo("release-blocker")}, {Name: pointTo("okay-after-beta1")}}, Milestone: &github.Milestone{ID: pointTo(int64(1))}}},
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: github.String("release-blocker")}, {Name: github.String("okay-after-beta1")}}, Milestone: &github.Milestone{ID: github.Int64(1)}}},
|
||||
version: "go1.20beta1", kind: KindBeta,
|
||||
want: nil, // Want no error.
|
||||
},
|
||||
{
|
||||
name: "beta 2 with one hard blocker and meaningless okay-after-beta1 label",
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: pointTo("release-blocker")}, {Name: pointTo("okay-after-beta1")}}, Milestone: &github.Milestone{ID: pointTo(int64(1))}}},
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: github.String("release-blocker")}, {Name: github.String("okay-after-beta1")}}, Milestone: &github.Milestone{ID: github.Int64(1)}}},
|
||||
version: "go1.20beta2", kind: KindBeta,
|
||||
want: errManualApproval,
|
||||
},
|
||||
{
|
||||
name: "RC 1 with one hard blocker",
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: pointTo("release-blocker")}}, Milestone: &github.Milestone{ID: pointTo(int64(1))}}},
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: github.String("release-blocker")}}, Milestone: &github.Milestone{ID: github.Int64(1)}}},
|
||||
version: "go1.20rc1", kind: KindRC,
|
||||
want: errManualApproval,
|
||||
},
|
||||
{
|
||||
name: "RC 1 with one blocker marked okay-after-rc1",
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: pointTo("release-blocker")}, {Name: pointTo("okay-after-rc1")}}, Milestone: &github.Milestone{ID: pointTo(int64(1))}}},
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: github.String("release-blocker")}, {Name: github.String("okay-after-rc1")}}, Milestone: &github.Milestone{ID: github.Int64(1)}}},
|
||||
version: "go1.20rc1", kind: KindRC,
|
||||
want: nil, // Want no error.
|
||||
},
|
||||
{
|
||||
name: "RC 2 with one hard blocker and meaningless okay-after-rc1 label",
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: pointTo("release-blocker")}, {Name: pointTo("okay-after-rc1")}}, Milestone: &github.Milestone{ID: pointTo(int64(1))}}},
|
||||
issues: map[int]*github.Issue{123: {Labels: []*github.Label{{Name: github.String("release-blocker")}, {Name: github.String("okay-after-rc1")}}, Milestone: &github.Milestone{ID: github.Int64(1)}}},
|
||||
version: "go1.20rc2", kind: KindRC,
|
||||
want: errManualApproval,
|
||||
},
|
||||
|
|
|
@ -415,7 +415,7 @@ func TestCreateReleaseIssue(t *testing.T) {
|
|||
version: "v0.16.2",
|
||||
fakeGithub: FakeGitHub{
|
||||
Milestones: map[int]string{1: "gopls/v0.16.2"},
|
||||
Issues: map[int]*github.Issue{2: {Number: pointTo(2), Title: pointTo("x/tools/gopls: release version v0.16.2"), Milestone: &github.Milestone{ID: pointTo(int64(1))}}},
|
||||
Issues: map[int]*github.Issue{2: {Number: github.Int(2), Title: github.String("x/tools/gopls: release version v0.16.2"), Milestone: &github.Milestone{ID: github.Int64(1)}}},
|
||||
},
|
||||
wantErr: false,
|
||||
wantIssue: 2,
|
||||
|
|
Загрузка…
Ссылка в новой задаче