Skip to content

Commit

Permalink
Merge pull request #438 from junotx/unittest
Browse files Browse the repository at this point in the history
fix unittest
  • Loading branch information
benjaminhuo authored Jan 18, 2024
2 parents 576ece3 + 7b77dd5 commit 8c21009
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions pkg/util/envoy_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
var EnvoyStaticConfigTemplate = template.Must(template.New("envoy.yaml").Parse(dedent.Dedent(`
static_resources:
listeners:
{{ if .LocalServiceEnabled }}
{{- if .LocalServiceEnabled }}
- name: self_listener
address:
socket_address:
Expand Down Expand Up @@ -46,8 +46,8 @@ static_resources:
filename: {{ .ServiceTLSCertFile }}
private_key:
filename: {{ .ServiceTLSKeyFile }}
{{ end }}
{{ if .ProxyServiceEnabled }}
{{- end }}
{{- if .ProxyServiceEnabled }}
- name: proxy_listener
address:
socket_address:
Expand All @@ -74,9 +74,9 @@ static_resources:
cluster: upstrean_serivce
http_filters:
- name: envoy.filters.http.router
{{ end }}
{{- end }}
clusters:
{{ if .LocalServiceEnabled }}
{{- if .LocalServiceEnabled }}
- name: local_serivce
type: STATIC
lb_policy: ROUND_ROBIN
Expand All @@ -89,8 +89,8 @@ static_resources:
socket_address:
address: 127.0.0.1
port_value: {{ .ServiceListenPort }}
{{ end }}
{{ if .ProxyServiceEnabled }}
{{- end }}
{{- if .ProxyServiceEnabled }}
- name: upstrean_serivce
type: STRICT_DNS
lb_policy: ROUND_ROBIN
Expand All @@ -111,5 +111,5 @@ static_resources:
validation_context:
trust_chain_verification: ACCEPT_UNTRUSTED
sni: {{ .ProxyServiceAddress }}
{{ end }}
{{- end }}
`)))
20 changes: 10 additions & 10 deletions pkg/util/envoy_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@ static_resources:
socket_address:
address: query-whizard-operated.kubesphere-monitoring-system.svc
port_value: 10902
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
'@type': type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
common_tls_context:
validation_context:
trust_chain_verification: ACCEPT_UNTRUSTED
alpn_protocols: 'h2,http/1.1'
sni: query-whizard-operated.kubesphere-monitoring-system.svc
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
'@type': type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
common_tls_context:
validation_context:
trust_chain_verification: ACCEPT_UNTRUSTED
sni: query-whizard-operated.kubesphere-monitoring-system.svc
`

func TestTempExec(t *testing.T) {
variables := map[string]string{
variables := map[string]interface{}{
"LocalServiceEnabled": true,
"ServiceMappingPort": "10902",
"ServiceListenPort": "10904",
"ServiceTLSCertFile": "/etc/whizard/certs/tls.crt",
Expand Down

0 comments on commit 8c21009

Please sign in to comment.