Skip to content

Commit

Permalink
Remove set namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyunchen committed Jul 16, 2018
1 parent 720c014 commit 79b23c0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 0 additions & 4 deletions src/kubernetes/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ func New(clientset kubernetes.Interface, namespace string) *KubeCtl {
Namespace: namespace,
}
}

func (kc *KubeCtl) SetNamespace(namespace string) {
kc.Namespace = namespace
}
2 changes: 0 additions & 2 deletions src/kubernetes/kubectl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ func TestNewKubeCtl(t *testing.T) {
kubectl := New(clientset, namespace)
assert.Equal(t, namespace, kubectl.Namespace)
assert.NotNil(t, kubectl)
// Change struct namespace field value
kubectl.SetNamespace("test")
}
9 changes: 4 additions & 5 deletions src/prometheuscontroller/expression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type PrometheusExpressionTestSuite struct {
func (suite *PrometheusExpressionTestSuite) SetupSuite() {
cf := config.MustRead("../../config/local.json")
suite.sp = serviceprovider.New(cf)
suite.sp.KubeCtl.SetNamespace("monitoring")
}

func (suite *PrometheusExpressionTestSuite) TearDownSuite() {
Expand Down Expand Up @@ -69,7 +68,7 @@ func (suite *PrometheusExpressionTestSuite) TestListNodeNICs() {
}

func (suite *PrometheusExpressionTestSuite) TestGetPod() {
namespace := "default"
namespace := "monitoring"
pods, err := suite.sp.KubeCtl.GetPods(namespace)
suite.NoError(err)
podName := pods[0].GetName()
Expand All @@ -80,7 +79,7 @@ func (suite *PrometheusExpressionTestSuite) TestGetPod() {
}

func (suite *PrometheusExpressionTestSuite) TestGetContainer() {
namespace := "default"
namespace := "monitoring"
pods, err := suite.sp.KubeCtl.GetPods(namespace)
suite.NoError(err)
containerName := pods[0].Status.ContainerStatuses[0].Name
Expand All @@ -91,7 +90,7 @@ func (suite *PrometheusExpressionTestSuite) TestGetContainer() {
}

func (suite *PrometheusExpressionTestSuite) TestGetService() {
namespace := "default"
namespace := "monitoring"
services, err := suite.sp.KubeCtl.GetServices(namespace)
suite.NoError(err)
serviceName := services[0].GetName()
Expand All @@ -102,7 +101,7 @@ func (suite *PrometheusExpressionTestSuite) TestGetService() {
}

func (suite *PrometheusExpressionTestSuite) TestGetController() {
namespace := "default"
namespace := "monitoring"
deployments, err := suite.sp.KubeCtl.GetDeployments(namespace)
suite.NoError(err)
deploymentName := deployments[0].GetName()
Expand Down

0 comments on commit 79b23c0

Please sign in to comment.