Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
Signed-off-by: Raghav Kaul <[email protected]>
  • Loading branch information
raghavkaul committed May 23, 2023
1 parent 1e08b55 commit a313680
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion clients/gitlabrepo/commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (handler *commitsHandler) listRawCommits() ([]*gitlab.Commit, error) {
return handler.commitsRaw, nil
}

// zip combines Commit and MergeRequest information from the GitLab REST API with
// zip combines Commit information from the GitLab REST API with MergeRequests
// information from the GitLab GraphQL API. The REST API doesn't provide any way to
// get from Commits -> MRs that they were part of or vice-versa (MRs -> commits they
// contain), except through a separate API call. Instead of calling the REST API
Expand Down
4 changes: 2 additions & 2 deletions clients/gitlabrepo/graphql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ func TestGitlabRepoE2E(t *testing.T) {
}
t.Parallel()
RegisterFailHandler(Fail)
RunSpecs(t, "Githubrepo Suite")
RunSpecs(t, "GitLab Repo Suite")
}

var _ = Describe("E2E TEST: gitlabrepo.graphqlHandler", func() {
var graphqlhandler graphqlHandler

Context("E2E TEST: Confirm query result", func() {
Context("E2E TEST: Confirm query result - GitLab", func() {
It("Should have sufficient number of merge requests", func() {
repo, err := MakeGitlabRepo("gitlab.com/gitlab-org/gitlab")
Expect(err).Should(BeNil())
Expand Down
10 changes: 6 additions & 4 deletions e2e/ci_tests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ var _ = Describe("E2E TEST:"+checks.CheckCITests, func() {
repoClient, err := gitlabrepo.CreateGitlabClientWithToken(context.Background(), os.Getenv("GITLAB_AUTH_TOKEN"), repo)
Expect(err).Should(BeNil())
// url to commit is https://gitlab.com/gitlab-org/gitlab/-/commit/8ae23fa220d73fa07501aabd94214c9e83fe61a0
err = repoClient.InitRepo(repo, "HEAD", 0)
err = repoClient.InitRepo(repo, "8ae23fa220d73fa07501aabd94214c9e83fe61a0", 0)
Expect(err).Should(BeNil())
req := checker.CheckRequest{
Ctx: context.Background(),
Expand All @@ -122,12 +122,13 @@ var _ = Describe("E2E TEST:"+checks.CheckCITests, func() {
}
expected := scut.TestReturn{
Error: nil,
Score: 8,
NumberOfWarn: 0,
NumberOfInfo: 0,
NumberOfDebug: 13,
}
result := checks.CITests(&req)
Expect(result.Score).Should(BeNumerically(">", expected.Score))
Expect(result.Score).Should(BeNumerically("==", expected.Score))
Expect(result.Error).Should(BeNil())
Expect(repoClient.Close()).Should(BeNil())
})
Expand All @@ -140,7 +141,7 @@ var _ = Describe("E2E TEST:"+checks.CheckCITests, func() {
repoClient, err := gitlabrepo.CreateGitlabClientWithToken(context.Background(), os.Getenv("GITLAB_AUTH_TOKEN"), repo)
Expect(err).Should(BeNil())
// url to commit is https://gitlab.com/fdroid/fdroidclient/-/commit/a1d33881902cee33586a4fd4ee1538042a7bdedf
err = repoClient.InitRepo(repo, "HEAD", 0)
err = repoClient.InitRepo(repo, "a1d33881902cee33586a4fd4ee1538042a7bdedf", 0)
Expect(err).Should(BeNil())
req := checker.CheckRequest{
Ctx: context.Background(),
Expand All @@ -150,12 +151,13 @@ var _ = Describe("E2E TEST:"+checks.CheckCITests, func() {
}
expected := scut.TestReturn{
Error: nil,
Score: 10,
NumberOfWarn: 0,
NumberOfInfo: 0,
NumberOfDebug: 1,
}
result := checks.CITests(&req)
Expect(result.Score).Should(BeNumerically(">", expected.Score))
Expect(result.Score).Should(BeNumerically("==", expected.Score))
Expect(result.Error).Should(BeNil())
Expect(repoClient.Close()).Should(BeNil())
})
Expand Down
4 changes: 2 additions & 2 deletions e2e/code_review_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ var _ = Describe("E2E TEST:"+checks.CheckCodeReview, func() {
Expect(err).Should(BeNil())
repoClient, err := gitlabrepo.CreateGitlabClientWithToken(context.Background(), os.Getenv("GITLAB_AUTH_TOKEN"), repo)
Expect(err).Should(BeNil())
err = repoClient.InitRepo(repo, "680a1154cf3806390c2e4a9e95a7c6d6107b470f", 0)
err = repoClient.InitRepo(repo, "1f7ed43c120047102862d9d1d644f5b2de7a47f2", 0)
Expect(err).Should(BeNil())

req := checker.CheckRequest{
Expand All @@ -170,7 +170,7 @@ var _ = Describe("E2E TEST:"+checks.CheckCodeReview, func() {
}
expected := scut.TestReturn{
Error: nil,
Score: 3,
Score: 0,
NumberOfDebug: 1,
}
result := checks.CodeReview(&req)
Expand Down

0 comments on commit a313680

Please sign in to comment.