mirror of
https://github.com/ngrok/ngrok-operator.git
synced 2026-05-17 16:50:44 +00:00
1e2367de30
* chore(rename): Replace kubernetes-ingress-controller with ngrok-operator rg github.com/ngrok/kubernetes-ingress-controller . --files-with-matches | xargs sed -i 's/github.com\/ngrok\/kubernetes-ingress-controller/github.com\/ngrok\/ngrok-operator/g' * chore(rename): Move helm/ingress-controller -> helm/ngrok-operator * chore(rename): More updates
37 lines
1003 B
Go
37 lines
1003 B
Go
package tls
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/ngrok/ngrok-operator/internal/annotations/parser"
|
|
"github.com/ngrok/ngrok-operator/internal/annotations/testutil"
|
|
"github.com/ngrok/ngrok-operator/internal/errors"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestTLSTerminationWhenNotSupplied(t *testing.T) {
|
|
ing := testutil.NewIngress()
|
|
ing.SetAnnotations(map[string]string{})
|
|
parsed, err := NewParser().Parse(ing)
|
|
|
|
assert.Nil(t, parsed)
|
|
assert.Error(t, err)
|
|
assert.True(t, errors.IsMissingAnnotations(err))
|
|
}
|
|
|
|
func TestTLSTerminationWhenSupplied(t *testing.T) {
|
|
ing := testutil.NewIngress()
|
|
annotations := map[string]string{}
|
|
annotations[parser.GetAnnotationWithPrefix("tls-min-version")] = "1.3"
|
|
ing.SetAnnotations(annotations)
|
|
|
|
parsed, err := NewParser().Parse(ing)
|
|
assert.NoError(t, err)
|
|
|
|
tlsTermination, ok := parsed.(*EndpointTLSTerminationAtEdge)
|
|
if !ok {
|
|
t.Fatalf("expected *EndpointTLSTerminationAtEdge, got %T", parsed)
|
|
}
|
|
assert.Equal(t, "1.3", tlsTermination.MinVersion)
|
|
}
|