Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
adapted unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bacherfl committed Aug 24, 2022
1 parent 2b2d9ce commit a87fe4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/sdk/internal/api/initializer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package api
import (
"fmt"
keptnapi "github.com/keptn/go-utils/pkg/api/utils"
keptnapiv2 "github.com/keptn/go-utils/pkg/api/utils/v2"
"github.com/keptn/go-utils/pkg/sdk/connector/logger"
"github.com/keptn/go-utils/pkg/sdk/internal/config"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -40,7 +41,8 @@ func Test_Initialize(t *testing.T) {
require.NotNil(t, result.EventSenderCallback)
require.NotNil(t, result.KeptnAPI)
require.IsType(t, &keptnapi.APISet{}, result.KeptnAPI)
require.NotNil(t, result.ResourceHandler)
require.NotNil(t, result.KeptnAPIV2)
require.IsType(t, &keptnapiv2.APISet{}, result.KeptnAPIV2)
})
t.Run("Internal Use case - internal api set is used", func(t *testing.T) {
env := config.EnvConfig{}
Expand All @@ -50,7 +52,8 @@ func Test_Initialize(t *testing.T) {
require.NotNil(t, result.EventSenderCallback)
require.NotNil(t, result.KeptnAPI)
require.IsType(t, &keptnapi.InternalAPISet{}, result.KeptnAPI)
require.NotNil(t, result.ResourceHandler)
require.NotNil(t, result.KeptnAPIV2)
require.IsType(t, &keptnapiv2.InternalAPISet{}, result.KeptnAPIV2)
})
t.Run("HTTP client creation fails", func(t *testing.T) {
env := config.EnvConfig{KeptnAPIEndpoint: "http://endpoint"}
Expand All @@ -66,6 +69,7 @@ func Test_Initialize(t *testing.T) {
require.NotNil(t, result.EventSenderCallback)
require.NotNil(t, result.KeptnAPI)
require.IsType(t, &keptnapi.APISet{}, result.KeptnAPI)
require.NotNil(t, result.ResourceHandler)
require.NotNil(t, result.KeptnAPIV2)
require.IsType(t, &keptnapiv2.APISet{}, result.KeptnAPIV2)
})
}
1 change: 1 addition & 0 deletions pkg/sdk/keptn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func Test_NewKeptn(t *testing.T) {
require.IsType(t, keptnSDK.taskRegistry.Get("event2.type").taskHandler, &TaskHandlerMock{})
require.NotNil(t, keptnSDK.GetResourceHandler())
require.NotNil(t, keptnSDK.APIV1())
require.NotNil(t, keptnSDK.APIV2())

})
}
Expand Down

0 comments on commit a87fe4f

Please sign in to comment.