-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Divya Pamecha <21123621+Its-Maniaco@users.noreply.github.com>
- Loading branch information
1 parent
fa0c4a1
commit 8214bbc
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |