testt: small improvement in repository test
@@ -26,6 +26,7 @@ import (
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
"github.com/apache/camel-k/pkg/client/camel/clientset/versioned/fake"
"github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
@@ -130,15 +131,15 @@ func TestNewRepository(t *testing.T) {
ctx := context.Background()
fakeClient := fake.NewSimpleClientset(createTestContext("none")...)
repo, err := New(ctx, fakeClient, "test")
- assert.NoError(t, err)
+ require.NoError(t, err)
list, err := repo.List(ctx)
- assert.NoError(t, err)
+ require.NoError(t, err)
assert.Len(t, list, 2)
k1, err := repo.Get(ctx, "kamelet1")
- assert.NoError(t, err)
+ require.NoError(t, err)
assert.Equal(t, "kamelet1", k1.Name)
k2, err := repo.Get(ctx, "kamelet2")
- assert.NoError(t, err)
+ require.NoError(t, err)
assert.Equal(t, "kamelet2", k2.Name)
}
@@ -146,15 +147,15 @@ func TestNewRepositoryWithCamelKamelets(t *testing.T) {
ctx := context.Background()
fakeClient := fake.NewSimpleClientset(createTestContext("github:apache/camel-kamelets/kamelets")...)
repo, err := New(ctx, fakeClient, "test")
- assert.NoError(t, err)
+ require.NoError(t, err)
list, err := repo.List(ctx)
- assert.NoError(t, err)
+ require.NoError(t, err)
assert.True(t, len(list) > 2)
k1, err := repo.Get(ctx, "kamelet1")
- assert.NoError(t, err)
+ require.NoError(t, err)
assert.Equal(t, "kamelet1", k1.Name)
k2, err := repo.Get(ctx, "kamelet2")
- assert.NoError(t, err)
+ require.NoError(t, err)
assert.Equal(t, "kamelet2", k2.Name)
}
@@ -162,15 +163,15 @@ func TestNewRepositoryWithDefault(t *testing.T) {
ctx := context.Background()
fakeClient := fake.NewSimpleClientset(createTestContext()...)
repo, err := New(ctx, fakeClient, "test")
- assert.NoError(t, err)
+ require.NoError(t, err)
list, err := repo.List(ctx)
- assert.NoError(t, err)
+ require.NoError(t, err)
assert.Len(t, list, 2)
k1, err := repo.Get(ctx, "kamelet1")
- assert.NoError(t, err)
+ require.NoError(t, err)
assert.Equal(t, "kamelet1", k1.Name)
k2, err := repo.Get(ctx, "kamelet2")
- assert.NoError(t, err)
+ require.NoError(t, err)
assert.Equal(t, "kamelet2", k2.Name)
}
