Skip to content

Commit

Permalink
Remove unused namepace helper
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
  • Loading branch information
pablochacin committed Jun 28, 2023
1 parent b864d41 commit 7763aa9
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 95 deletions.
22 changes: 0 additions & 22 deletions e2e/kubernetes/kubernetes_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package e2e

import (
"context"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -39,27 +38,6 @@ func Test_Kubernetes(t *testing.T) {
return
}

kubeconfig := cluster.Kubeconfig()

// Test Creating a random namespace
t.Run("Create Random Namespace", func(t *testing.T) {
k8s, err := kubernetes.NewFromKubeconfig(kubeconfig)
if err != nil {
t.Errorf("error creating kubernetes client: %v", err)
return
}
prefix := "test"
ns, err := k8s.NamespaceHelper().CreateRandomNamespace(context.TODO(), prefix)
if err != nil {
t.Errorf("unexpected error creating namespace: %v", err)
return
}
if !strings.HasPrefix(ns, prefix) {
t.Errorf("returned namespace does not have expected prefix '%s': %s", prefix, ns)
}
})


// Test Wait Pod Running
t.Run("Wait Pod is Running", func(t *testing.T) {
namespace, err := namespace.CreateTestNamespace(context.TODO(), t, k8s.Client())
Expand Down
7 changes: 0 additions & 7 deletions pkg/kubernetes/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ func (f *FakeKubernetes) ServiceHelper(namespace string) helpers.ServiceHelper {
)
}

// NamespaceHelper returns a NamespaceHelper for the given namespace
func (f *FakeKubernetes) NamespaceHelper() helpers.NamespaceHelper {
return helpers.NewFakeNamespaceHelper(
f.client,
)
}

// Client return a kubernetes client
func (f *FakeKubernetes) Client() kubernetes.Interface {
return f.client
Expand Down
14 changes: 0 additions & 14 deletions pkg/kubernetes/helpers/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,6 @@ func NewFakeServiceHelper(
}
}

// fakeNamespaceHelper is an fake instance of a NamespaceHelper. It can delegate to the actual
// helper the execution of actions or override them when needed
type fakeNamespaceHelper struct {
NamespaceHelper
}

// NewFakeNamespaceHelper creates a set of a NamespaceHelper on the default namespace
func NewFakeNamespaceHelper(client kubernetes.Interface) NamespaceHelper {
h := NewNamespaceHelper(client)
return &fakeNamespaceHelper{
h,
}
}

// FakeHTTPClient implement a fake HTTPClient that returns a fixed response.
// When invoked, it records the request it received
type FakeHTTPClient struct {
Expand Down
43 changes: 0 additions & 43 deletions pkg/kubernetes/helpers/namespaces.go

This file was deleted.

9 changes: 0 additions & 9 deletions pkg/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ type Kubernetes interface {
ServiceHelper(namespace string) helpers.ServiceHelper
// PodHelper returns a helpers.PodHelper scoped for the given namespace
PodHelper(namespace string) helpers.PodHelper
// NamespaceHelper returns a namespace helper
NamespaceHelper() helpers.NamespaceHelper
}

// k8s Holds the reference to the helpers for interacting with kubernetes
Expand Down Expand Up @@ -127,13 +125,6 @@ func (k *k8s) PodHelper(namespace string) helpers.PodHelper {
)
}

// NamespaceHelper returns a NamespaceHelper
func (k *k8s) NamespaceHelper() helpers.NamespaceHelper {
return helpers.NewNamespaceHelper(
k.Interface,
)
}

func (k *k8s) Client() kubernetes.Interface {
return k.Interface
}

0 comments on commit 7763aa9

Please sign in to comment.