Skip to content

Commit

Permalink
Always set JDBC timeout environment variables so that older docker im…
Browse files Browse the repository at this point in the history
…ages will function correctly. (#507)
  • Loading branch information
misterdorito authored Jan 9, 2023
1 parent 0fcbb36 commit 966316c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 9 additions & 3 deletions charts/pega/templates/pega-environment-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@ data:
# The connection properties that will be sent to our JDBC driver when establishing new connections
JDBC_CONNECTION_PROPERTIES: {{ .Values.global.jdbc.connectionProperties }}
{{- end }}
# The jdbc connection timeout properties for the primary PegaRULES datasource.
{{- if .Values.global.jdbc.connectionTimeoutProperties }}
# The jdbc connection timeout properties for the primary PegaRULES datasource.
JDBC_TIMEOUT_PROPERTIES: {{ .Values.global.jdbc.connectionTimeoutProperties }}
{{- else }}
JDBC_TIMEOUT_PROPERTIES: ""
{{- end }}
# The jdbc connection timeout properties for the PegaRULESLongRW datasource.
{{- if .Values.global.jdbc.writerConnectionTimeoutProperties }}
# The jdbc connection timeout properties for the PegaRULESLongRW datasource.
JDBC_TIMEOUT_PROPERTIES_RW: {{ .Values.global.jdbc.writerConnectionTimeoutProperties }}
{{- else }}
JDBC_TIMEOUT_PROPERTIES_RW: ""
{{- end }}
{{- if .Values.global.jdbc.readerConnectionTimeoutProperties }}
# The jdbc connection timeout properties for the PegaRULESReadOnly datasource.
{{- if .Values.global.jdbc.readerConnectionTimeoutProperties }}
JDBC_TIMEOUT_PROPERTIES_RO: {{ .Values.global.jdbc.readerConnectionTimeoutProperties }}
{{- else }}
JDBC_TIMEOUT_PROPERTIES_RO: ""
{{- end }}
# Rules schema of the Pega installation
{{ if (eq (include "performUpgradeAndDeployment" .) "true") }}
Expand Down
12 changes: 6 additions & 6 deletions terratest/src/test/pega/pega-environment-config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,23 @@ func TestPegaEnvironmentConfigJDBCTimeouts(t * testing.T) {

yamlContent := RenderTemplate(t, options, helmChartPath, []string{"templates/pega-environment-config.yaml"})

VerifyEnvNotPresent(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES")
VerifyEnvNotPresent(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES_RW")
VerifyEnvNotPresent(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES_RO")
VerifyEnvValue(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES", "")
VerifyEnvValue(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES_RW", "")
VerifyEnvValue(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES_RO", "")

options.SetValues["global.jdbc.connectionTimeoutProperties"] = "socketTimeout=90;"
yamlContent = RenderTemplate(t, options, helmChartPath, []string{"templates/pega-environment-config.yaml"})

VerifyEnvValue(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES", "socketTimeout=90;")
VerifyEnvNotPresent(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES_RW")
VerifyEnvNotPresent(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES_RO")
VerifyEnvValue(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES_RW", "")
VerifyEnvValue(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES_RO", "")

options.SetValues["global.jdbc.writerConnectionTimeoutProperties"] = "socketTimeout=120;"
yamlContent = RenderTemplate(t, options, helmChartPath, []string{"templates/pega-environment-config.yaml"})

VerifyEnvValue(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES", "socketTimeout=90;")
VerifyEnvValue(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES_RW", "socketTimeout=120;")
VerifyEnvNotPresent(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES_RO")
VerifyEnvValue(t, yamlContent, "JDBC_TIMEOUT_PROPERTIES_RO", "")

options.SetValues["global.jdbc.readerConnectionTimeoutProperties"] = "socketTimeout=150;"
yamlContent = RenderTemplate(t, options, helmChartPath, []string{"templates/pega-environment-config.yaml"})
Expand Down

0 comments on commit 966316c

Please sign in to comment.