mirror of https://github.com/status-im/consul.git
ensure consul config write has snake case conversions for MeshGateway (#6062)
This commit is contained in:
parent
3eb3ee5a15
commit
065550e1c5
|
@ -138,7 +138,13 @@ func newDecodeConfigEntry(raw map[string]interface{}) (api.ConfigEntry, error) {
|
|||
|
||||
switch entry.GetKind() {
|
||||
case api.ProxyDefaults:
|
||||
translateKeysDict = map[string]string{
|
||||
"mesh_gateway": "meshgateway",
|
||||
}
|
||||
case api.ServiceDefaults:
|
||||
translateKeysDict = map[string]string{
|
||||
"mesh_gateway": "meshgateway",
|
||||
}
|
||||
case api.ServiceRouter:
|
||||
skipWhenPatching = []string{
|
||||
"routes",
|
||||
|
|
|
@ -145,6 +145,9 @@ func TestParseConfigEntry(t *testing.T) {
|
|||
"moar" = "config"
|
||||
}
|
||||
}
|
||||
mesh_gateway {
|
||||
mode = "remote"
|
||||
}
|
||||
`,
|
||||
camel: `
|
||||
Kind = "proxy-defaults"
|
||||
|
@ -156,6 +159,9 @@ func TestParseConfigEntry(t *testing.T) {
|
|||
"moar" = "config"
|
||||
}
|
||||
}
|
||||
MeshGateway {
|
||||
Mode = "remote"
|
||||
}
|
||||
`,
|
||||
expect: &api.ProxyConfigEntry{
|
||||
Kind: "proxy-defaults",
|
||||
|
@ -167,6 +173,9 @@ func TestParseConfigEntry(t *testing.T) {
|
|||
"moar": "config",
|
||||
},
|
||||
},
|
||||
MeshGateway: api.MeshGatewayConfig{
|
||||
Mode: api.MeshGatewayModeRemote,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -175,16 +184,25 @@ func TestParseConfigEntry(t *testing.T) {
|
|||
kind = "service-defaults"
|
||||
name = "main"
|
||||
protocol = "http"
|
||||
mesh_gateway {
|
||||
mode = "remote"
|
||||
}
|
||||
`,
|
||||
camel: `
|
||||
Kind = "service-defaults"
|
||||
Name = "main"
|
||||
Protocol = "http"
|
||||
MeshGateway {
|
||||
Mode = "remote"
|
||||
}
|
||||
`,
|
||||
expect: &api.ServiceConfigEntry{
|
||||
Kind: "service-defaults",
|
||||
Name: "main",
|
||||
Protocol: "http",
|
||||
MeshGateway: api.MeshGatewayConfig{
|
||||
Mode: api.MeshGatewayModeRemote,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue