From 73dc4c6bb04f5f1b952d667ce48b2f46b2b266fd Mon Sep 17 00:00:00 2001 From: Adithya Viswanathan Date: Wed, 5 Jul 2023 16:11:56 +0530 Subject: [PATCH] [feat]: [CDS-73030]: tests fix --- scm/driver/gitee/integration/git_test.go | 2 +- scm/driver/github/integration/git_test.go | 2 +- scm/driver/gitlab/git.go | 2 +- scm/driver/gitlab/integration/git_test.go | 2 +- scm/example_test.go | 9 +++------ 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/scm/driver/gitee/integration/git_test.go b/scm/driver/gitee/integration/git_test.go index 9921584eb..d7267fc60 100644 --- a/scm/driver/gitee/integration/git_test.go +++ b/scm/driver/gitee/integration/git_test.go @@ -51,7 +51,7 @@ func testBranchFind(client *scm.Client) func(t *testing.T) { func testBranchList(client *scm.Client) func(t *testing.T) { return func(t *testing.T) { t.Parallel() - opts := scm.BranchListOptions{} + opts := scm.ListOptions{} result, _, err := client.Git.ListBranches(context.Background(), "kit101/drone-yml-test", opts) if err != nil { t.Error(err) diff --git a/scm/driver/github/integration/git_test.go b/scm/driver/github/integration/git_test.go index b13d71d99..2915ad2f8 100644 --- a/scm/driver/github/integration/git_test.go +++ b/scm/driver/github/integration/git_test.go @@ -51,7 +51,7 @@ func testBranchFind(client *scm.Client) func(t *testing.T) { func testBranchList(client *scm.Client) func(t *testing.T) { return func(t *testing.T) { t.Parallel() - opts := scm.BranchListOptions{} + opts := scm.ListOptions{} result, _, err := client.Git.ListBranches(context.Background(), "octocat/Hello-World", opts) if err != nil { t.Error(err) diff --git a/scm/driver/gitlab/git.go b/scm/driver/gitlab/git.go index a2293524e..3bc37ef7d 100644 --- a/scm/driver/gitlab/git.go +++ b/scm/driver/gitlab/git.go @@ -54,7 +54,7 @@ func (s *gitService) FindTag(ctx context.Context, repo, name string) (*scm.Refer } func (s *gitService) ListBranches(ctx context.Context, repo string, opts scm.ListOptions) ([]*scm.Reference, *scm.Response, error) { - path := fmt.Sprintf("api/v4/projects/%s/repository/branches?search=%s&%s", encode(repo), encodeListOptions(opts)) + path := fmt.Sprintf("api/v4/projects/%s/repository/branches?%s", encode(repo), encodeListOptions(opts)) out := []*branch{} res, err := s.client.do(ctx, "GET", path, nil, &out) return convertBranchList(out), res, err diff --git a/scm/driver/gitlab/integration/git_test.go b/scm/driver/gitlab/integration/git_test.go index 446fe8579..e51dbbcf9 100644 --- a/scm/driver/gitlab/integration/git_test.go +++ b/scm/driver/gitlab/integration/git_test.go @@ -51,7 +51,7 @@ func testBranchFind(client *scm.Client) func(t *testing.T) { func testBranchList(client *scm.Client) func(t *testing.T) { return func(t *testing.T) { t.Parallel() - opts := scm.BranchListOptions{} + opts := scm.ListOptions{} result, _, err := client.Git.ListBranches(context.Background(), "gitlab-org/testme", opts) if err != nil { t.Error(err) diff --git a/scm/example_test.go b/scm/example_test.go index e77185e9e..f95aaff7d 100644 --- a/scm/example_test.go +++ b/scm/example_test.go @@ -111,12 +111,9 @@ func ExampleGitService_ListBranches() { log.Fatal(err) } - opts := scm.BranchListOptions{ - PageListOptions: struct { - URL string - Page int - Size int - }{Page: 1, Size: 30}, + opts := scm.ListOptions{ + Page: 1, + Size: 30, } branches, _, err := client.Git.ListBranches(ctx, "octocat/Hello-World", opts)