Skip to content

Commit

Permalink
adding exporter test
Browse files Browse the repository at this point in the history
Signed-off-by: Divya Pamecha <21123621+Its-Maniaco@users.noreply.github.com>
  • Loading branch information
Its-Maniaco committed Jan 30, 2024
1 parent fa0c4a1 commit 8214bbc
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions controller/controller_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package controller

import (
"testing"

"github.com/litmuschaos/chaos-exporter/controller/mocks"
clientv1alpha1 "github.com/litmuschaos/chaos-operator/pkg/client/clientset/versioned"
"github.com/stretchr/testify/mock"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
)

type MockClientSets struct {
mock.Mock
}

func (c *MockClientSets) MockKubeClient() kubernetes.Interface {
mockArgs := c.Called()
return mockArgs.Get(0).(kubernetes.Interface)
}

func (c *MockClientSets) MockLitmusClient() clientv1alpha1.Interface {
mockArgs := c.Called()
return mockArgs.Get(0).(clientv1alpha1.Interface)
}

func (c *MockClientSets) MockKubeConfig() *rest.Config {
mockArgs := c.Called()
return mockArgs.Get(0).(*rest.Config)
}

func TestExporter(t *testing.T) {
// mockClientSets := new(MockClientSets)

// mockClientSets.On("GetKubeClient").Return( /* mock behavior */ )
mockCollectData := mocks.NewMockResultCollector(mockCtl)

Exporter(*mockClientSets)
}

0 comments on commit 8214bbc

Please sign in to comment.