From 9bcda2de45065d59853f979c3dbf49cff085f0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarik=20G=C3=BCrsoy?= Date: Tue, 20 Aug 2024 11:46:46 +0200 Subject: [PATCH] Use require instead of assert, as mentioned by the CI-Warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tarik Gürsoy --- applicationset/services/pull_request/scm-manager_test.go | 5 +++-- applicationset/services/scm_provider/scm-manager_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/applicationset/services/pull_request/scm-manager_test.go b/applicationset/services/pull_request/scm-manager_test.go index eabce92f00e33a..db3563f358792d 100644 --- a/applicationset/services/pull_request/scm-manager_test.go +++ b/applicationset/services/pull_request/scm-manager_test.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "io" "net/http" "net/http/httptest" @@ -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) diff --git a/applicationset/services/scm_provider/scm-manager_test.go b/applicationset/services/scm_provider/scm-manager_test.go index 178959ed4c2886..7dcf3c1a8df705 100644 --- a/applicationset/services/scm_provider/scm-manager_test.go +++ b/applicationset/services/scm_provider/scm-manager_test.go @@ -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 { @@ -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) }) }