mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-29 17:07:24 +02:00
config: fix redirect routes from protobuf (#1930)
This commit is contained in:
parent
8b42eb5ebd
commit
e56fb38cb5
2 changed files with 33 additions and 13 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"testing"
|
||||
|
||||
envoy_config_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -214,4 +215,20 @@ func TestPolicy_FromToPb(t *testing.T) {
|
|||
assert.Equal(t, tc.expectedPolicyName, policyFromPb.EnvoyOpts.Name)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("redirect route", func(t *testing.T) {
|
||||
p := &Policy{
|
||||
From: "https://pomerium.io",
|
||||
Redirect: &PolicyRedirect{
|
||||
HTTPSRedirect: proto.Bool(true),
|
||||
},
|
||||
}
|
||||
|
||||
pbPolicy, err := p.ToProto()
|
||||
require.NoError(t, err)
|
||||
|
||||
policyFromProto, err := NewPolicyFromProto(pbPolicy)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, p.Redirect.HTTPSRedirect, policyFromProto.Redirect.HTTPSRedirect)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue