Skip to content

Commit

Permalink
add tests for templating docker-compose without core-node (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim Fehrs authored Oct 2, 2023
1 parent 86ac61c commit ced5e0f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions node-runner-cli/templates/radix-fullnode-compose.yml.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: '3.8'
services:
{% if core_node is not none %}
{% if core_node is not none and core_node is defined %}
core:
cap_add:
- NET_ADMIN
Expand Down Expand Up @@ -57,7 +57,7 @@ services:
{% if core_node is defined %}
RADIXDLT_NETWORK_USE_PROXY_PROTOCOL: '{{core_node.use_proxy_protocol or 'false'}}'
{% endif %}
{% if core_node is not defined %}
{% if core_node is not defined or core_node is none %}
RADIXDLT_ENABLE_TCP_CORE_PROXY: 'false'
{% endif %}
RADIXDLT_GATEWAY_API_ENABLE: '{{common_config.nginx_settings.protect_gateway or 'false'}}'
Expand Down
11 changes: 11 additions & 0 deletions node-runner-cli/tests/unit/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ def test_docker_version_update(self):
docker_config = DockerSetup.update_versions(docker_config, True)
self.assertNotEqual("oldversion", docker_config.core_node.core_release)

def test_docker_compose_template_without_core_node(self):
docker_config = DockerConfig({})
docker_config.core_node.core_release = "1.2.3"
docker_config.common_config.nginx_settings.release = "1.2.3"
compose = DockerSetup.render_docker_compose(docker_config)
self.assertEqual(False, hasattr(compose["services"]["nginx"]["environment"], "RADIXDLT_ENABLE_TCP_CORE_PROXY"))
del docker_config.core_node
compose = DockerSetup.render_docker_compose(docker_config)
self.assertEqual("false", compose["services"]["nginx"]["environment"]["RADIXDLT_ENABLE_TCP_CORE_PROXY"])


def suite():
""" This defines all the tests of a module"""
suite = unittest.TestSuite()
Expand Down

0 comments on commit ced5e0f

Please sign in to comment.