Skip to content

Commit

Permalink
Clean up Scrap_tests
Browse files Browse the repository at this point in the history
Signed-off-by: nagesh bansal <[email protected]>
  • Loading branch information
Nageshbansal committed Aug 14, 2023
1 parent c3ebd2c commit 488c2a1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/controller_test/scrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/litmuschaos/chaos-exporter/controller"
"github.com/litmuschaos/chaos-exporter/controller/mocks"
v1alpha1 "github.com/litmuschaos/chaos-operator/api/litmuschaos/v1alpha1"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"testing"
)
Expand All @@ -13,10 +14,6 @@ func TestGetLitmusChaosMetrics(t *testing.T) {
mockCtl := gomock.NewController(t)
defer mockCtl.Finish()
mockCollectData := mocks.NewMockResultCollector(mockCtl)

//FakeEngineName := "Fake Engine"
//FakeNamespace := "Fake Namespace"

tests := []struct {
name string
execFunc func()
Expand Down Expand Up @@ -53,6 +50,7 @@ func TestGetLitmusChaosMetrics(t *testing.T) {
},
},
monitoring: &controller.MonitoringEnabled{},
isErr: false,
},
}
for _, tt := range tests {
Expand All @@ -66,9 +64,11 @@ func TestGetLitmusChaosMetrics(t *testing.T) {

r.GaugeMetrics.InitializeGaugeMetrics().RegisterFixedMetrics()
err := r.GetLitmusChaosMetrics(client, tt.overallChaosResult, tt.monitoring)
if !tt.isErr && err != nil {
t.Fatalf("test Failed as not able to get the Chaos result list")
if tt.isErr {
require.Error(t, err)
return
}
require.NoError(t, err)
})
}

Expand Down

0 comments on commit 488c2a1

Please sign in to comment.