mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-12-05 08:12:26 -08:00
Ensure haproxy.cfg ends with 2 newlines?
This commit is contained in:
1 parent
aa20ceb3d3
commit
7e38818cd7
4 files changed
+27
-1
No files matched your search
@@ -18,8 +18,9 @@ app.kubernetes.io/version: {{ include "element-io.ess-library.labels.makeSafe" .
|
||||
{{- define "element-io.haproxy.configmap-data" }}
|
||||
{{- $root := .root -}}
|
||||
{{- with required "element-io.haproxy.configmap-data missing context" .context -}}
|
||||
haproxy.cfg: |
|
||||
haproxy.cfg: |+
|
||||
{{- tpl ($root.Files.Get "configs/haproxy/haproxy.cfg.tpl") (dict "root" $root "context" .) | nindent 2 }}
|
||||
placeholder: Ensure there's something after haproxy.cfg for https://github.com/element-hq/ess-helm/issues/821
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Ensure there's at least 2 newlines at the end of the `haproxy.cfg` file.
|
||||
@@ -453,6 +453,7 @@ all_components_details = [
|
||||
has_ingress=False,
|
||||
is_shared_component=True,
|
||||
makes_outbound_requests=False,
|
||||
paths_consistency_noqa=("/usr/local/etc/haproxy/placeholder",),
|
||||
skip_path_consistency_for_files=("haproxy.cfg", "429.http", "path_map_file", "path_map_file_get"),
|
||||
),
|
||||
ComponentDetails(
|
||||
|
||||
@@ -55,3 +55,26 @@ async def test_haproxy_server_templates_reference_valid_services(templates):
|
||||
break
|
||||
else:
|
||||
raise AssertionError(f"{service_name} did not have a port named {desired_port} referenced in {line}")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("values_file", values_files_to_test)
|
||||
@pytest.mark.asyncio_cooperative
|
||||
async def test_haproxy_config_ends_in_2_newlines(templates):
|
||||
seen_haproxy = False
|
||||
haproxy_configmap = None
|
||||
for template in templates:
|
||||
if template_to_deployable_details(template).name != "haproxy":
|
||||
continue
|
||||
seen_haproxy = True
|
||||
|
||||
if template["kind"] == "ConfigMap":
|
||||
haproxy_configmap = template
|
||||
|
||||
if not seen_haproxy:
|
||||
return
|
||||
|
||||
assert haproxy_configmap, "No HAProxy ConfigMap found"
|
||||
assert "haproxy.cfg" in haproxy_configmap["data"], f"{template_id(haproxy_configmap)} didn't contain haproxy.cfg"
|
||||
assert haproxy_configmap["data"]["haproxy.cfg"].endswith("\n\n"), (
|
||||
f"{template_id(haproxy_configmap)}/haproxy.cfg should end with at least 2 \\n"
|
||||
)
|
||||
Reference in new issue
Block a user