Skip to content

Commit

Permalink
test(gateway): add test with GatewayClass.Spec.ParametersRef
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Beaumont <mjboamail@gmail.com>
  • Loading branch information
michaelbeaumont committed Apr 11, 2022
1 parent cbc211c commit a2f068a
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions test/e2e/gateway/gatewayapi/gateway_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gatewayapi

import (
"net"
"time"

"github.com/gruntwork-io/terratest/modules/k8s"
. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -115,6 +116,56 @@ func GatewayAPI() {
return ip
}

Describe("GatewayClass parametersRef", Ordered, func() {
haGatewayClass := `
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: GatewayClass
metadata:
name: kuma
spec:
controllerName: gateways.kuma.io/controller
parametersRef:
kind: MeshGatewayConfig
group: kuma.io
name: haConfig`

haConfig := `
apiVersion: kuma.io/v1alpha1
kind: MeshGatewayConfig
metadata:
name: haConfig
spec:
replicas: 3`

haGateway := `
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
name: kuma
namespace: kuma-test
spec:
gatewayClassName: kuma
listeners:
- name: proxy
port: 8080
protocol: HTTP`

BeforeAll(func() {
E2EDeferCleanup(func() error {
return k8s.RunKubectlE(cluster.GetTesting(), cluster.GetKubectlOptions(TestNamespace), "delete", "gateway", "kuma")
})
Expect(YamlK8s(haConfig)(cluster)).To(Succeed())
// TODO this shouldn't be necessary, need to reconcile on MeshGatewayConfig
time.Sleep(10 * time.Second)
Expect(YamlK8s(haGatewayClass)(cluster)).To(Succeed())
Expect(YamlK8s(haGateway)(cluster)).To(Succeed())
})

It("should create the right number of pods", func() {
Expect(cluster.WaitApp("kuma", "kuma-test", 3)).To(Succeed())
})
})

Context("HTTP Gateway", Ordered, func() {
gateway := `
apiVersion: gateway.networking.k8s.io/v1alpha2
Expand Down

0 comments on commit a2f068a

Please sign in to comment.