mirror of
https://github.com/kubevirt/kubevirt.core.git
synced 2026-05-08 22:32:58 +00:00
kubevirt_vm: Prevent unnecessary whitespace
This removes the unnecessary whitespace from the rendered VirtualMachine template and adds a unit test for it. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This commit is contained in:
@@ -284,11 +284,11 @@ spec:
|
|||||||
{% if instancetype %}
|
{% if instancetype %}
|
||||||
instancetype:
|
instancetype:
|
||||||
{{ instancetype | to_yaml | indent(4) }}
|
{{ instancetype | to_yaml | indent(4) }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if preference %}
|
{% if preference %}
|
||||||
preference:
|
preference:
|
||||||
{{ preference | to_yaml | indent(4) }}
|
{{ preference | to_yaml | indent(4) }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if data_volume_templates %}
|
{% if data_volume_templates %}
|
||||||
dataVolumeTemplates:
|
dataVolumeTemplates:
|
||||||
{{ data_volume_templates | to_yaml | indent(4) }}
|
{{ data_volume_templates | to_yaml | indent(4) }}
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ FIXTURE1 = {
|
|||||||
},
|
},
|
||||||
"spec": {
|
"spec": {
|
||||||
"running": True,
|
"running": True,
|
||||||
|
"instancetype": {
|
||||||
|
"name": "u1.medium"
|
||||||
|
},
|
||||||
|
"preference": {
|
||||||
|
"name": "fedora"
|
||||||
|
},
|
||||||
"dataVolumeTemplates": [
|
"dataVolumeTemplates": [
|
||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
@@ -86,6 +92,10 @@ metadata:
|
|||||||
service: loadbalancer
|
service: loadbalancer
|
||||||
spec:
|
spec:
|
||||||
running: True
|
running: True
|
||||||
|
instancetype:
|
||||||
|
name: u1.medium
|
||||||
|
preference:
|
||||||
|
name: fedora
|
||||||
dataVolumeTemplates:
|
dataVolumeTemplates:
|
||||||
- metadata:
|
- metadata:
|
||||||
name: testdv
|
name: testdv
|
||||||
@@ -118,6 +128,12 @@ FIXTURE2 = {
|
|||||||
'service': 'loadbalancer',
|
'service': 'loadbalancer',
|
||||||
'environment': 'staging'
|
'environment': 'staging'
|
||||||
},
|
},
|
||||||
|
'instancetype': {
|
||||||
|
'name': 'u1.medium'
|
||||||
|
},
|
||||||
|
'preference': {
|
||||||
|
'name': 'fedora'
|
||||||
|
},
|
||||||
'data_volume_templates': [
|
'data_volume_templates': [
|
||||||
{
|
{
|
||||||
'metadata': {
|
'metadata': {
|
||||||
@@ -149,10 +165,10 @@ FIXTURE2 = {
|
|||||||
'terminationGracePeriodSeconds': 180
|
'terminationGracePeriodSeconds': 180
|
||||||
},
|
},
|
||||||
'api_version': 'kubevirt.io/v1', 'running': True, 'wait': False, 'wait_sleep': 5, 'wait_timeout': 120, 'force': False,
|
'api_version': 'kubevirt.io/v1', 'running': True, 'wait': False, 'wait_sleep': 5, 'wait_timeout': 120, 'force': False,
|
||||||
'generate_name': None, 'annotations': None, 'instancetype': None, 'preference': None,
|
'generate_name': None, 'annotations': None, 'kubeconfig': None, 'context': None, 'host': None, 'api_key': None,
|
||||||
'kubeconfig': None, 'context': None, 'host': None, 'api_key': None, 'username': None, 'password': None, 'validate_certs': None,
|
'username': None, 'password': None, 'validate_certs': None, 'ca_cert': None, 'client_cert': None, 'client_key': None,
|
||||||
'ca_cert': None, 'client_cert': None, 'client_key': None, 'proxy': None, 'no_proxy': None, 'proxy_headers': None,
|
'proxy': None, 'no_proxy': None, 'proxy_headers': None, 'persist_config': None, 'impersonate_user': None,
|
||||||
'persist_config': None, 'impersonate_user': None, 'impersonate_groups': None, 'delete_options': None,
|
'impersonate_groups': None, 'delete_options': None,
|
||||||
'resource_definition': METADATA,
|
'resource_definition': METADATA,
|
||||||
'wait_condition': {
|
'wait_condition': {
|
||||||
'type': 'Ready',
|
'type': 'Ready',
|
||||||
@@ -196,6 +212,12 @@ class TestCreateVM(unittest.TestCase):
|
|||||||
"service": "loadbalancer",
|
"service": "loadbalancer",
|
||||||
"environment": "staging"
|
"environment": "staging"
|
||||||
},
|
},
|
||||||
|
'instancetype': {
|
||||||
|
'name': 'u1.medium'
|
||||||
|
},
|
||||||
|
'preference': {
|
||||||
|
'name': 'fedora'
|
||||||
|
},
|
||||||
'data_volume_templates': [
|
'data_volume_templates': [
|
||||||
{
|
{
|
||||||
'metadata': {
|
'metadata': {
|
||||||
|
|||||||
Reference in New Issue
Block a user