mirror of https://github.com/status-im/consul.git
50 lines
930 B
Go
50 lines
930 B
Go
|
package meshv1alpha1
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
func TestIsTransprentProxy(t *testing.T) {
|
||
|
cases := map[string]struct {
|
||
|
proxyCfg *ProxyConfiguration
|
||
|
exp bool
|
||
|
}{
|
||
|
"nil dynamic config": {
|
||
|
proxyCfg: &ProxyConfiguration{},
|
||
|
exp: false,
|
||
|
},
|
||
|
"default mode": {
|
||
|
proxyCfg: &ProxyConfiguration{
|
||
|
DynamicConfig: &DynamicConfig{
|
||
|
Mode: ProxyMode_PROXY_MODE_DEFAULT,
|
||
|
},
|
||
|
},
|
||
|
exp: false,
|
||
|
},
|
||
|
"direct mode": {
|
||
|
proxyCfg: &ProxyConfiguration{
|
||
|
DynamicConfig: &DynamicConfig{
|
||
|
Mode: ProxyMode_PROXY_MODE_DEFAULT,
|
||
|
},
|
||
|
},
|
||
|
exp: false,
|
||
|
},
|
||
|
"transparent mode": {
|
||
|
proxyCfg: &ProxyConfiguration{
|
||
|
DynamicConfig: &DynamicConfig{
|
||
|
Mode: ProxyMode_PROXY_MODE_TRANSPARENT,
|
||
|
},
|
||
|
},
|
||
|
exp: true,
|
||
|
},
|
||
|
}
|
||
|
|
||
|
for name, c := range cases {
|
||
|
t.Run(name, func(t *testing.T) {
|
||
|
require.Equal(t, c.exp, c.proxyCfg.IsTransparentProxy())
|
||
|
})
|
||
|
}
|
||
|
}
|