Skip to content

Commit

Permalink
include a test for the config changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dprotaso committed Jun 18, 2024
1 parent 0d57fe1 commit 2d6aa8e
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions third_party/envoy-gateway/config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
Copyright 2024 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
"os"
"testing"

corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/yaml"

"knative.dev/net-gateway-api/pkg/reconciler/ingress/config"
)

func TestFromConfigMap(t *testing.T) {
bytes, err := os.ReadFile(config.GatewayConfigName + ".yaml")
if err != nil {
t.Fatalf("failed to read %q: %s", config.GatewayConfigName, err)
}

cm := &corev1.ConfigMap{}
err = yaml.Unmarshal(bytes, cm)
if err != nil {
t.Fatalf("failed to unmarshal %q: %s", config.GatewayConfigName, err)
}

if _, err := config.FromConfigMap(cm); err != nil {
t.Error("FromConfigMap(actual) =", err)
}
}

0 comments on commit 2d6aa8e

Please sign in to comment.