Skip to content

Commit

Permalink
Use require instead of assert, as mentioned by the CI-Warning
Browse files Browse the repository at this point in the history
Signed-off-by: Tarik Gürsoy <[email protected]>
  • Loading branch information
karat-1 committed Aug 20, 2024
1 parent 80db07c commit 9bcda2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions applicationset/services/pull_request/scm-manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"io"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -97,9 +98,9 @@ func TestScmManagerPrList(t *testing.T) {
}))
defer ts.Close()
host, err := NewScmManagerService(context.Background(), "", ts.URL, "test-argocd", "pr-test", false, "", nil)
assert.NoError(t, err)
require.NoError(t, err)
prs, err := host.List(context.Background())
assert.NoError(t, err)
require.NoError(t, err)
assert.Len(t, prs, 1)
assert.Equal(t, 1, prs[0].Number)
assert.Equal(t, "test_pr", prs[0].Branch)
Expand Down
8 changes: 4 additions & 4 deletions applicationset/services/scm_provider/scm-manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func TestScmManagerListRepos(t *testing.T) {
if c.hasError {
assert.Error(t, err)
} else {
assert.NoError(t, err)
require.NoError(t, err)
repos := []*Repository{}
branches := []string{}
for _, r := range rawRepos {
Expand Down Expand Up @@ -175,19 +175,19 @@ func TestScmManagerHasPath(t *testing.T) {

t.Run("file exists", func(t *testing.T) {
ok, err := host.RepoHasPath(context.Background(), repo, "README.md")
assert.NoError(t, err)
require.NoError(t, err)
assert.True(t, ok)
})

t.Run("directory exists", func(t *testing.T) {
ok, err := host.RepoHasPath(context.Background(), repo, "build")
assert.NoError(t, err)
require.NoError(t, err)
assert.True(t, ok)
})

t.Run("does not exists", func(t *testing.T) {
ok, err := host.RepoHasPath(context.Background(), repo, "unknownFile")
assert.NoError(t, err)
require.NoError(t, err)
assert.False(t, ok)
})
}

0 comments on commit 9bcda2d

Please sign in to comment.