Skip to content

Commit

Permalink
update test environment function
Browse files Browse the repository at this point in the history
  • Loading branch information
ccfish2 committed Jul 9, 2021
1 parent 6a0b85b commit 888d730
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions railgun/test/performance/perf_ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/kong/kubernetes-ingress-controller/pkg/annotations"
k8sgen "github.com/kong/kubernetes-testing-framework/pkg/generators/k8s"
generators "github.com/kong/kubernetes-testing-framework/pkg/generators/k8s"
)

func TestIngressPerformance(t *testing.T) {
Expand All @@ -29,18 +29,18 @@ func TestIngressPerformance(t *testing.T) {
assert.NoError(t, err)

t.Log("deploying a minimal HTTP container deployment to test Ingress routes")
container := k8sgen.NewContainer("httpbin", httpBinImage, 80)
deployment := k8sgen.NewDeploymentForContainer(container)
container := generators.NewContainer("httpbin", httpBinImage, 80)
deployment := generators.NewDeploymentForContainer(container)
deployment, err = cluster.Client().AppsV1().Deployments(namespace).Create(ctx, deployment, metav1.CreateOptions{})
assert.NoError(t, err)

t.Logf("exposing deployment %s via service", deployment.Name)
service := k8sgen.NewServiceForDeployment(deployment, corev1.ServiceTypeLoadBalancer)
service := generators.NewServiceForDeployment(deployment, corev1.ServiceTypeLoadBalancer)
_, err = cluster.Client().CoreV1().Services(namespace).Create(ctx, service, metav1.CreateOptions{})
assert.NoError(t, err)

t.Logf("[%s] creating an ingress for service httpbin with ingress.class %s", namespace, ingressClass)
ingress := k8sgen.NewIngressForService("/httpbin", map[string]string{
ingress := generators.NewIngressForService("/httpbin", map[string]string{
annotations.IngressClassKey: ingressClass,
"konghq.com/strip-path": "true",
}, service)
Expand Down
6 changes: 3 additions & 3 deletions railgun/test/performance/perf_tcpingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/kong/kubernetes-ingress-controller/pkg/annotations"
kongv1beta1 "github.com/kong/kubernetes-ingress-controller/railgun/apis/configuration/v1beta1"
"github.com/kong/kubernetes-ingress-controller/railgun/pkg/clientset"
k8sgen "github.com/kong/kubernetes-testing-framework/pkg/generators/k8s"
generators "github.com/kong/kubernetes-testing-framework/pkg/generators/k8s"
)

func TestTCPIngressPerformance(t *testing.T) {
Expand All @@ -36,12 +36,12 @@ func TestTCPIngressPerformance(t *testing.T) {

t.Log("deploying a minimal HTTP container deployment to test Ingress routes")
testName := "tcpingress"
deployment := k8sgen.NewDeploymentForContainer(k8sgen.NewContainer(testName, httpBinImage, 80))
deployment := generators.NewDeploymentForContainer(generators.NewContainer(testName, httpBinImage, 80))
deployment, err = cluster.Client().AppsV1().Deployments(namespace).Create(ctx, deployment, metav1.CreateOptions{})
require.NoError(t, err)

t.Logf("exposing deployment %s via service", deployment.Name)
service := k8sgen.NewServiceForDeployment(deployment, corev1.ServiceTypeLoadBalancer)
service := generators.NewServiceForDeployment(deployment, corev1.ServiceTypeLoadBalancer)
service, err = cluster.Client().CoreV1().Services(namespace).Create(ctx, service, metav1.CreateOptions{})
require.NoError(t, err)

Expand Down
8 changes: 4 additions & 4 deletions railgun/test/performance/perf_udpingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/kong/kubernetes-ingress-controller/railgun/apis/configuration/v1beta1"
kongv1beta1 "github.com/kong/kubernetes-ingress-controller/railgun/apis/configuration/v1beta1"
"github.com/kong/kubernetes-ingress-controller/railgun/pkg/clientset"
k8sgen "github.com/kong/kubernetes-testing-framework/pkg/generators/k8s"
generators "github.com/kong/kubernetes-testing-framework/pkg/generators/k8s"
)

func TestUDPIngressPerformance(t *testing.T) {
Expand All @@ -38,11 +38,11 @@ func TestUDPIngressPerformance(t *testing.T) {
assert.NoError(t, err)

t.Log("configuring a coredns deployent to deploy for UDP testing")
container := k8sgen.NewContainer("coredns", "coredns/coredns", 53)
container := generators.NewContainer("coredns", "coredns/coredns", 53)
container.Ports[0].Protocol = corev1.ProtocolUDP
container.VolumeMounts = []corev1.VolumeMount{{Name: "config-volume", MountPath: "/etc/coredns"}}
container.Args = []string{"-conf", "/etc/coredns/Corefile"}
deployment := k8sgen.NewDeploymentForContainer(container)
deployment := generators.NewDeploymentForContainer(container)

t.Log("configuring the coredns pod with a custom corefile")
configVolume := corev1.Volume{
Expand All @@ -57,7 +57,7 @@ func TestUDPIngressPerformance(t *testing.T) {
assert.NoError(t, err)

t.Logf("exposing deployment %s via service", deployment.Name)
service := k8sgen.NewServiceForDeployment(deployment, corev1.ServiceTypeLoadBalancer)
service := generators.NewServiceForDeployment(deployment, corev1.ServiceTypeLoadBalancer)
service, err = cluster.Client().CoreV1().Services(testUDPIngressNamespace).Create(ctx, service, metav1.CreateOptions{})
assert.NoError(t, err)

Expand Down

0 comments on commit 888d730

Please sign in to comment.