1
0
Fork 0
mirror of synced 2024-12-22 06:31:07 -05:00

Add arch to template tests

This commit is contained in:
Tim Byrne 2021-12-23 15:42:43 -06:00
parent bacc948bba
commit 4843e1fa14
No known key found for this signature in database
GPG key ID: 14DB4FC2465A4B12
3 changed files with 42 additions and 0 deletions

View file

@ -5,6 +5,7 @@ FILE_MODE = 0o754
# these values are also testing the handling of bizarre characters # these values are also testing the handling of bizarre characters
LOCAL_CLASS = "default_Test+@-!^Class" LOCAL_CLASS = "default_Test+@-!^Class"
LOCAL_ARCH = "default_Test+@-!^Arch"
LOCAL_SYSTEM = "default_Test+@-!^System" LOCAL_SYSTEM = "default_Test+@-!^System"
LOCAL_HOST = "default_Test+@-!^Host" LOCAL_HOST = "default_Test+@-!^Host"
LOCAL_USER = "default_Test+@-!^User" LOCAL_USER = "default_Test+@-!^User"
@ -12,6 +13,7 @@ LOCAL_DISTRO = "default_Test+@-!^Distro"
TEMPLATE = f''' TEMPLATE = f'''
start of template start of template
default class = >{{{{yadm.class}}}}< default class = >{{{{yadm.class}}}}<
default arch = >{{{{yadm.arch}}}}<
default os = >{{{{yadm.os}}}}< default os = >{{{{yadm.os}}}}<
default host = >{{{{yadm.hostname}}}}< default host = >{{{{yadm.hostname}}}}<
default user = >{{{{yadm.user}}}}< default user = >{{{{yadm.user}}}}<
@ -33,6 +35,15 @@ Should not be included...
{{% if yadm.class == "wrongclass2" %}} {{% if yadm.class == "wrongclass2" %}}
wrong class 2 wrong class 2
{{% endif %}} {{% endif %}}
{{% if yadm.arch == "wrongarch1" %}}
wrong arch 1
{{% endif %}}
{{% if yadm.arch == "{LOCAL_ARCH}" %}}
Included section for arch = {{{{yadm.arch}}}} ({{{{yadm.arch}}}} repeated)
{{% endif %}}
{{% if yadm.arch == "wrongarch2" %}}
wrong arch 2
{{% endif %}}
{{% if yadm.os == "wrongos1" %}} {{% if yadm.os == "wrongos1" %}}
wrong os 1 wrong os 1
{{% endif %}} {{% endif %}}
@ -74,6 +85,7 @@ end of template
EXPECTED = f''' EXPECTED = f'''
start of template start of template
default class = >{LOCAL_CLASS}< default class = >{LOCAL_CLASS}<
default arch = >{LOCAL_ARCH}<
default os = >{LOCAL_SYSTEM}< default os = >{LOCAL_SYSTEM}<
default host = >{LOCAL_HOST}< default host = >{LOCAL_HOST}<
default user = >{LOCAL_USER}< default user = >{LOCAL_USER}<
@ -81,6 +93,7 @@ default distro = >{LOCAL_DISTRO}<
Included section from else Included section from else
Included section for class = {LOCAL_CLASS} ({LOCAL_CLASS} repeated) Included section for class = {LOCAL_CLASS} ({LOCAL_CLASS} repeated)
Multiple lines Multiple lines
Included section for arch = {LOCAL_ARCH} ({LOCAL_ARCH} repeated)
Included section for os = {LOCAL_SYSTEM} ({LOCAL_SYSTEM} repeated) Included section for os = {LOCAL_SYSTEM} ({LOCAL_SYSTEM} repeated)
Included section for host = {LOCAL_HOST} ({LOCAL_HOST} again) Included section for host = {LOCAL_HOST} ({LOCAL_HOST} again)
Included section for user = {LOCAL_USER} ({LOCAL_USER} repeated) Included section for user = {LOCAL_USER} ({LOCAL_USER} repeated)
@ -137,6 +150,7 @@ def test_template_default(runner, yadm, tmpdir):
YADM_TEST=1 source {yadm} YADM_TEST=1 source {yadm}
set_awk set_awk
local_class="{LOCAL_CLASS}" local_class="{LOCAL_CLASS}"
local_arch="{LOCAL_ARCH}"
local_system="{LOCAL_SYSTEM}" local_system="{LOCAL_SYSTEM}"
local_host="{LOCAL_HOST}" local_host="{LOCAL_HOST}"
local_user="{LOCAL_USER}" local_user="{LOCAL_USER}"

View file

@ -4,6 +4,7 @@ import os
FILE_MODE = 0o754 FILE_MODE = 0o754
LOCAL_CLASS = "esh_Test+@-!^Class" LOCAL_CLASS = "esh_Test+@-!^Class"
LOCAL_ARCH = "esh_Test+@-!^Arch"
LOCAL_SYSTEM = "esh_Test+@-!^System" LOCAL_SYSTEM = "esh_Test+@-!^System"
LOCAL_HOST = "esh_Test+@-!^Host" LOCAL_HOST = "esh_Test+@-!^Host"
LOCAL_USER = "esh_Test+@-!^User" LOCAL_USER = "esh_Test+@-!^User"
@ -11,6 +12,7 @@ LOCAL_DISTRO = "esh_Test+@-!^Distro"
TEMPLATE = f''' TEMPLATE = f'''
start of template start of template
esh class = ><%=$YADM_CLASS%>< esh class = ><%=$YADM_CLASS%><
esh arch = ><%=$YADM_ARCH%><
esh os = ><%=$YADM_OS%>< esh os = ><%=$YADM_OS%><
esh host = ><%=$YADM_HOSTNAME%>< esh host = ><%=$YADM_HOSTNAME%><
esh user = ><%=$YADM_USER%>< esh user = ><%=$YADM_USER%><
@ -24,6 +26,15 @@ Included section for class = <%=$YADM_CLASS%> (<%=$YADM_CLASS%> repeated)
<% if [ "$YADM_CLASS" = "wrongclass2" ]; then -%> <% if [ "$YADM_CLASS" = "wrongclass2" ]; then -%>
wrong class 2 wrong class 2
<% fi -%> <% fi -%>
<% if [ "$YADM_ARCH" = "wrongarch1" ]; then -%>
wrong arch 1
<% fi -%>
<% if [ "$YADM_ARCH" = "{LOCAL_ARCH}" ]; then -%>
Included section for arch = <%=$YADM_ARCH%> (<%=$YADM_ARCH%> repeated)
<% fi -%>
<% if [ "$YADM_ARCH" = "wrongarch2" ]; then -%>
wrong arch 2
<% fi -%>
<% if [ "$YADM_OS" = "wrongos1" ]; then -%> <% if [ "$YADM_OS" = "wrongos1" ]; then -%>
wrong os 1 wrong os 1
<% fi -%> <% fi -%>
@ -65,11 +76,13 @@ end of template
EXPECTED = f''' EXPECTED = f'''
start of template start of template
esh class = >{LOCAL_CLASS}< esh class = >{LOCAL_CLASS}<
esh arch = >{LOCAL_ARCH}<
esh os = >{LOCAL_SYSTEM}< esh os = >{LOCAL_SYSTEM}<
esh host = >{LOCAL_HOST}< esh host = >{LOCAL_HOST}<
esh user = >{LOCAL_USER}< esh user = >{LOCAL_USER}<
esh distro = >{LOCAL_DISTRO}< esh distro = >{LOCAL_DISTRO}<
Included section for class = {LOCAL_CLASS} ({LOCAL_CLASS} repeated) Included section for class = {LOCAL_CLASS} ({LOCAL_CLASS} repeated)
Included section for arch = {LOCAL_ARCH} ({LOCAL_ARCH} repeated)
Included section for os = {LOCAL_SYSTEM} ({LOCAL_SYSTEM} repeated) Included section for os = {LOCAL_SYSTEM} ({LOCAL_SYSTEM} repeated)
Included section for host = {LOCAL_HOST} ({LOCAL_HOST} again) Included section for host = {LOCAL_HOST} ({LOCAL_HOST} again)
Included section for user = {LOCAL_USER} ({LOCAL_USER} repeated) Included section for user = {LOCAL_USER} ({LOCAL_USER} repeated)
@ -95,6 +108,7 @@ def test_template_esh(runner, yadm, tmpdir):
script = f""" script = f"""
YADM_TEST=1 source {yadm} YADM_TEST=1 source {yadm}
local_class="{LOCAL_CLASS}" local_class="{LOCAL_CLASS}"
local_arch="{LOCAL_ARCH}"
local_system="{LOCAL_SYSTEM}" local_system="{LOCAL_SYSTEM}"
local_host="{LOCAL_HOST}" local_host="{LOCAL_HOST}"
local_user="{LOCAL_USER}" local_user="{LOCAL_USER}"

View file

@ -5,6 +5,7 @@ import pytest
FILE_MODE = 0o754 FILE_MODE = 0o754
LOCAL_CLASS = "j2_Test+@-!^Class" LOCAL_CLASS = "j2_Test+@-!^Class"
LOCAL_ARCH = "j2_Test+@-!^Arch"
LOCAL_SYSTEM = "j2_Test+@-!^System" LOCAL_SYSTEM = "j2_Test+@-!^System"
LOCAL_HOST = "j2_Test+@-!^Host" LOCAL_HOST = "j2_Test+@-!^Host"
LOCAL_USER = "j2_Test+@-!^User" LOCAL_USER = "j2_Test+@-!^User"
@ -12,6 +13,7 @@ LOCAL_DISTRO = "j2_Test+@-!^Distro"
TEMPLATE = f''' TEMPLATE = f'''
start of template start of template
j2 class = >{{{{YADM_CLASS}}}}< j2 class = >{{{{YADM_CLASS}}}}<
j2 arch = >{{{{YADM_ARCH}}}}<
j2 os = >{{{{YADM_OS}}}}< j2 os = >{{{{YADM_OS}}}}<
j2 host = >{{{{YADM_HOSTNAME}}}}< j2 host = >{{{{YADM_HOSTNAME}}}}<
j2 user = >{{{{YADM_USER}}}}< j2 user = >{{{{YADM_USER}}}}<
@ -25,6 +27,15 @@ Included section for class = {{{{YADM_CLASS}}}} ({{{{YADM_CLASS}}}} repeated)
{{%- if YADM_CLASS == "wrongclass2" %}} {{%- if YADM_CLASS == "wrongclass2" %}}
wrong class 2 wrong class 2
{{%- endif %}} {{%- endif %}}
{{%- if YADM_ARCH == "wrongarch1" %}}
wrong arch 1
{{%- endif %}}
{{%- if YADM_ARCH == "{LOCAL_ARCH}" %}}
Included section for arch = {{{{YADM_ARCH}}}} ({{{{YADM_ARCH}}}} repeated)
{{%- endif %}}
{{%- if YADM_ARCH == "wrongarch2" %}}
wrong arch 2
{{%- endif %}}
{{%- if YADM_OS == "wrongos1" %}} {{%- if YADM_OS == "wrongos1" %}}
wrong os 1 wrong os 1
{{%- endif %}} {{%- endif %}}
@ -66,11 +77,13 @@ end of template
EXPECTED = f''' EXPECTED = f'''
start of template start of template
j2 class = >{LOCAL_CLASS}< j2 class = >{LOCAL_CLASS}<
j2 arch = >{LOCAL_ARCH}<
j2 os = >{LOCAL_SYSTEM}< j2 os = >{LOCAL_SYSTEM}<
j2 host = >{LOCAL_HOST}< j2 host = >{LOCAL_HOST}<
j2 user = >{LOCAL_USER}< j2 user = >{LOCAL_USER}<
j2 distro = >{LOCAL_DISTRO}< j2 distro = >{LOCAL_DISTRO}<
Included section for class = {LOCAL_CLASS} ({LOCAL_CLASS} repeated) Included section for class = {LOCAL_CLASS} ({LOCAL_CLASS} repeated)
Included section for arch = {LOCAL_ARCH} ({LOCAL_ARCH} repeated)
Included section for os = {LOCAL_SYSTEM} ({LOCAL_SYSTEM} repeated) Included section for os = {LOCAL_SYSTEM} ({LOCAL_SYSTEM} repeated)
Included section for host = {LOCAL_HOST} ({LOCAL_HOST} again) Included section for host = {LOCAL_HOST} ({LOCAL_HOST} again)
Included section for user = {LOCAL_USER} ({LOCAL_USER} repeated) Included section for user = {LOCAL_USER} ({LOCAL_USER} repeated)
@ -97,6 +110,7 @@ def test_template_j2(runner, yadm, tmpdir, processor):
script = f""" script = f"""
YADM_TEST=1 source {yadm} YADM_TEST=1 source {yadm}
local_class="{LOCAL_CLASS}" local_class="{LOCAL_CLASS}"
local_arch="{LOCAL_ARCH}"
local_system="{LOCAL_SYSTEM}" local_system="{LOCAL_SYSTEM}"
local_host="{LOCAL_HOST}" local_host="{LOCAL_HOST}"
local_user="{LOCAL_USER}" local_user="{LOCAL_USER}"