Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Nov 17, 2023
1 parent 60f4446 commit fb3709b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ metadata:
capabilities: Basic Install
categories: Integration & Delivery
containerImage: quay.io/kuadrant/kuadrant-operator:latest
createdAt: "2023-11-16T10:36:34Z"
createdAt: "2023-11-17T10:27:33Z"
operators.operatorframework.io/builder: operator-sdk-v1.28.1
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/Kuadrant/kuadrant-operator
Expand Down
11 changes: 6 additions & 5 deletions bundle/manifests/kuadrant.io_dnspolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
properties:
healthCheck:
description: HealthCheckSpec configures health checks in the DNS provider.
By default this health check will be applied to each unique DNS
By default, this health check will be applied to each unique DNS
A Record for the listeners assigned to the target gateway
properties:
additionalHeadersRef:
Expand Down Expand Up @@ -165,10 +165,11 @@ spec:
type: string
targetRef:
description: PolicyTargetReference identifies an API object to apply
policy to. This should be used as part of Policy resources that
can target Gateway API resources. For more information on how this
policy attachment model works, and a sample Policy resource, refer
to the policy attachment documentation for Gateway API.
a direct or inherited policy to. This should be used as part of
Policy resources that can target Gateway API resources. For more
information on how this policy attachment model works, and a sample
Policy resource, refer to the policy attachment documentation for
Gateway API.
properties:
group:
description: Group is the group of the target resource.
Expand Down
9 changes: 5 additions & 4 deletions bundle/manifests/kuadrant.io_tlspolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ spec:
type: integer
targetRef:
description: PolicyTargetReference identifies an API object to apply
policy to. This should be used as part of Policy resources that
can target Gateway API resources. For more information on how this
policy attachment model works, and a sample Policy resource, refer
to the policy attachment documentation for Gateway API.
a direct or inherited policy to. This should be used as part of
Policy resources that can target Gateway API resources. For more
information on how this policy attachment model works, and a sample
Policy resource, refer to the policy attachment documentation for
Gateway API.
properties:
group:
description: Group is the group of the target resource.
Expand Down
14 changes: 8 additions & 6 deletions controllers/authpolicy_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ var _ = Describe("AuthPolicy controller", func() {
It("Attaches policy to a Gateway with hostname in listeners", func() {
gatewayName := fmt.Sprintf("%s-with-hostnames", testGatewayName)
gateway := testBuildBasicGateway(gatewayName, testNamespace)
Expect(gateway.Spec.Listeners).Must(HaveLen(1))
Expect(gateway.Spec.Listeners).To(HaveLen(1))
// Set hostname
gateway.Spec.Listeners[0].Hostname = &[]gatewayapiv1.Hostname{"*.example.com"}[0]
err := k8sClient.Create(context.Background(), gateway)
Expand All @@ -149,14 +149,14 @@ var _ = Describe("AuthPolicy controller", func() {
TargetRef: gatewayapiv1alpha2.PolicyTargetReference{
Group: "gateway.networking.k8s.io",
Kind: "Gateway",
Name: gatewayName,
Name: gatewayapiv1.ObjectName(gatewayName),
Namespace: ptr.To(gatewayapiv1.Namespace(testNamespace)),
},
AuthScheme: testBasicAuthScheme(),
},
}

err := k8sClient.Create(context.Background(), policy)
err = k8sClient.Create(context.Background(), policy)
logf.Log.V(1).Info("Creating AuthPolicy", "key", client.ObjectKeyFromObject(policy).String(), "error", err)
Expect(err).ToNot(HaveOccurred())

Expand Down Expand Up @@ -1290,9 +1290,11 @@ func testBasicAuthScheme() api.AuthSchemeSpec {
}

func testGatewayIsReady(gateway *gatewayapiv1.Gateway) func() bool {
existingGateway := &gatewayapiv1.Gateway{}
err := k8sClient.Get(context.Background(), client.ObjectKeyFromObject(gateway), existingGateway)
return err == nil && meta.IsStatusConditionTrue(existingGateway.Status.Conditions, common.GatewayProgrammedConditionType)
return func() bool {
existingGateway := &gatewayapiv1.Gateway{}
err := k8sClient.Get(context.Background(), client.ObjectKeyFromObject(gateway), existingGateway)
return err == nil && meta.IsStatusConditionTrue(existingGateway.Status.Conditions, common.GatewayProgrammedConditionType)
}
}

func testPolicyIsReady(policy *api.AuthPolicy) func() bool {
Expand Down

0 comments on commit fb3709b

Please sign in to comment.