Skip to content

Commit

Permalink
Fix unit tests (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
julianvmodesto authored and tamalsaha committed Dec 13, 2017
1 parent bc592ef commit 082c6f0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 24 deletions.
2 changes: 1 addition & 1 deletion pkg/certificate/acme_test.go
Expand Up @@ -55,7 +55,7 @@ func TestClient(t *testing.T) {
},
ACMEUserSecretName: "foo",
Storage: api.CertificateStorage{
Secret: &api.SecretStore{},
Secret: &apiv1.LocalObjectReference{},
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/certificate/controller_test.go
Expand Up @@ -44,7 +44,7 @@ func TestEnsureClient(t *testing.T) {
Domains: strings.Split(os.Getenv("TEST_DNS_DOMAINS"), ","),
ACMEUserSecretName: "user",
ChallengeProvider: api.ChallengeProvider{DNS: &api.DNSChallengeProvider{Provider: "googlecloud", CredentialSecretName: "fakesecret"}},
Storage: api.CertificateStorage{Secret: &api.SecretStore{}},
Storage: api.CertificateStorage{Secret: &apiv1.LocalObjectReference{}},
},
}

Expand Down Expand Up @@ -85,7 +85,7 @@ func TestCreate(t *testing.T) {
Domains: strings.Split(os.Getenv("TEST_DNS_DOMAINS"), ","),
ACMEUserSecretName: "user",
ChallengeProvider: api.ChallengeProvider{DNS: &api.DNSChallengeProvider{Provider: "googlecloud", CredentialSecretName: "fakesecret"}},
Storage: api.CertificateStorage{Secret: &api.SecretStore{}},
Storage: api.CertificateStorage{Secret: &apiv1.LocalObjectReference{}},
},
}

Expand Down
4 changes: 1 addition & 3 deletions pkg/haproxy/template_test.go
Expand Up @@ -649,7 +649,6 @@ func TestTLSAuth(t *testing.T) {
Port: 80,
FrontendRules: []string{},
TLSAuth: &TLSAuth{
SecretName: "foo",
VerifyClient: "required",
Headers: map[string]string{
"X-TEST": "add",
Expand Down Expand Up @@ -677,8 +676,7 @@ func TestTLSAuth(t *testing.T) {
Port: 90,
FrontendRules: []string{},
TLSAuth: &TLSAuth{
SecretName: "foo",
ErrorPage: "google.com",
ErrorPage: "google.com",
},
Paths: []*HTTPPath{
{
Expand Down
15 changes: 7 additions & 8 deletions pkg/ingress/hostport_test.go
@@ -1,15 +1,14 @@
package ingress

import (
"fmt"
"testing"

api "github.com/appscode/voyager/apis/voyager/v1beta1"
"github.com/stretchr/testify/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
apiv1 "k8s.io/client-go/pkg/api/v1"
extensions "k8s.io/client-go/pkg/apis/extensions/v1beta1"
apps "k8s.io/client-go/pkg/apis/apps/v1beta1"
)

func TestHostPortController_IsExists(t *testing.T) {
Expand All @@ -26,7 +25,7 @@ func TestHostPortController_IsExists(t *testing.T) {
},
},
KubeClient: fake.NewSimpleClientset(
&extensions.DaemonSet{
&apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: api.VoyagerPrefix + "foo",
Namespace: "bar",
Expand Down Expand Up @@ -62,7 +61,7 @@ func TestHostPortController_IsExists(t *testing.T) {
},
},
KubeClient: fake.NewSimpleClientset(
&extensions.DaemonSet{
&apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: api.VoyagerPrefix + "fake-foo",
Namespace: "bar",
Expand Down Expand Up @@ -98,7 +97,7 @@ func TestHostPortController_IsExists(t *testing.T) {
},
},
KubeClient: fake.NewSimpleClientset(
&extensions.DaemonSet{
&apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: api.VoyagerPrefix + "foo",
Namespace: "bar",
Expand Down Expand Up @@ -133,7 +132,7 @@ func TestHostPortController_IsExists(t *testing.T) {
},
},
KubeClient: fake.NewSimpleClientset(
&extensions.DaemonSet{
&apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: api.VoyagerPrefix + "foo",
Namespace: "bar",
Expand Down Expand Up @@ -169,7 +168,7 @@ func TestHostPortController_IsExists(t *testing.T) {
},
},
KubeClient: fake.NewSimpleClientset(
&extensions.DaemonSet{
&apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: api.VoyagerPrefix + "foo",
Namespace: "bar",
Expand All @@ -195,7 +194,7 @@ func TestHostPortController_IsExists(t *testing.T) {
}

for k, v := range testCases {
fmt.Println(k.Ingress.Name, k.Ingress.Annotations)
t.Log(k.Ingress.Name, k.Ingress.Annotations)
assert.Equal(t, v, k.IsExists())
}
}
9 changes: 4 additions & 5 deletions pkg/ingress/loadbalancer_test.go
@@ -1,15 +1,14 @@
package ingress

import (
"fmt"
"testing"

api "github.com/appscode/voyager/apis/voyager/v1beta1"
"github.com/stretchr/testify/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
apiv1 "k8s.io/client-go/pkg/api/v1"
extensions "k8s.io/client-go/pkg/apis/extensions/v1beta1"
apps "k8s.io/client-go/pkg/apis/apps/v1beta1"
)

func TestLoadBalancerController_IsExists(t *testing.T) {
Expand All @@ -26,7 +25,7 @@ func TestLoadBalancerController_IsExists(t *testing.T) {
},
},
KubeClient: fake.NewSimpleClientset(
&extensions.Deployment{
&apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: api.VoyagerPrefix + "foo",
Namespace: "bar",
Expand Down Expand Up @@ -62,7 +61,7 @@ func TestLoadBalancerController_IsExists(t *testing.T) {
},
},
KubeClient: fake.NewSimpleClientset(
&extensions.Deployment{
&apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: api.VoyagerPrefix + "fakefoo",
Namespace: "bar",
Expand All @@ -88,7 +87,7 @@ func TestLoadBalancerController_IsExists(t *testing.T) {
}

for k, v := range testCases {
fmt.Println(k.Ingress.Name, k.Ingress.Annotations)
t.Log(k.Ingress.Name, k.Ingress.Annotations)
assert.Equal(t, v, k.IsExists())
}
}
9 changes: 4 additions & 5 deletions pkg/ingress/nodeport_test.go
@@ -1,15 +1,14 @@
package ingress

import (
"fmt"
"testing"

api "github.com/appscode/voyager/apis/voyager/v1beta1"
"github.com/stretchr/testify/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
apiv1 "k8s.io/client-go/pkg/api/v1"
extensions "k8s.io/client-go/pkg/apis/extensions/v1beta1"
apps "k8s.io/client-go/pkg/apis/apps/v1beta1"
)

func TestNodePortController_IsExists(t *testing.T) {
Expand All @@ -26,7 +25,7 @@ func TestNodePortController_IsExists(t *testing.T) {
},
},
KubeClient: fake.NewSimpleClientset(
&extensions.Deployment{
&apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: api.VoyagerPrefix + "foo",
Namespace: "bar",
Expand Down Expand Up @@ -62,7 +61,7 @@ func TestNodePortController_IsExists(t *testing.T) {
},
},
KubeClient: fake.NewSimpleClientset(
&extensions.Deployment{
&apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: api.VoyagerPrefix + "fakefoo",
Namespace: "bar",
Expand All @@ -88,7 +87,7 @@ func TestNodePortController_IsExists(t *testing.T) {
}

for k, v := range testCases {
fmt.Println(k.Ingress.Name, k.Ingress.Annotations)
t.Log(k.Ingress.Name, k.Ingress.Annotations)
assert.Equal(t, v, k.IsExists())
}
}

0 comments on commit 082c6f0

Please sign in to comment.