Skip to content

Commit

Permalink
Unit tests and fix contourDeployment manifest
Browse files Browse the repository at this point in the history
Signed-off-by: lubronzhan <lubronzhan@gmail.com>
  • Loading branch information
lubronzhan committed Jan 12, 2024
1 parent c232d2b commit d205e85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
10 changes: 0 additions & 10 deletions examples/namespaced-gatewayapi/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,3 @@ patches:
kind: ClusterRole
name: contour
version: v1
- patch: |-
- op: add
path: /spec/template/spec/containers/0/args/-
value: --watch-namespaces=projectcontour
target:
group: apps
kind: Deployment
name: contour
version: v1
9 changes: 8 additions & 1 deletion internal/provisioner/objects/deployment/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func TestDesiredDeployment(t *testing.T) {
cntr := model.Default(fmt.Sprintf("%s-ns", name), name)
icName := "test-ic"
cntr.Spec.IngressClassName = &icName

testNamespaces := "ns1,ns2,ns3"
resQutoa := corev1.ResourceRequirements{
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("400m"),
Expand All @@ -164,6 +164,9 @@ func TestDesiredDeployment(t *testing.T) {
// Change the Contour log level to test --debug.
cntr.Spec.ContourLogLevel = v1alpha1.DebugLog

// Change the Contour watch namespaces falg

Check failure on line 167 in internal/provisioner/objects/deployment/deployment_test.go

View workflow job for this annotation

GitHub Actions / Codespell

falg ==> flag
cntr.Spec.WatchNamespaces = &testNamespaces

cntr.Spec.ResourceLabels = map[string]string{
"key": "value",
}
Expand Down Expand Up @@ -207,10 +210,14 @@ func TestDesiredDeployment(t *testing.T) {
arg = fmt.Sprintf("--kubernetes-debug=%d", cntr.Spec.KubernetesLogLevel)
checkContainerHasArg(t, container, arg)

arg = fmt.Sprintf("--watch-namespaces=%s", *cntr.Spec.WatchNamespaces)
checkContainerHasArg(t, container, arg)

checkDeploymentHasNodeSelector(t, deploy, nil)
checkDeploymentHasTolerations(t, deploy, nil)
checkDeploymentHasResourceRequirements(t, deploy, resQutoa)
checkDeploymentHasStrategy(t, deploy, cntr.Spec.ContourDeploymentStrategy)

}

func TestNodePlacementDeployment(t *testing.T) {
Expand Down

0 comments on commit d205e85

Please sign in to comment.