Skip to content

Commit 2975681

Browse files
committed
fix: Fixed tests
1 parent 0cc8b6d commit 2975681

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

requirements-tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pytest_docker_tools==0.2.0
2-
pytest==5.4.1
2+
pytest==6.2.5
33
pytest-cov==2.8.1
44
pytest-twisted==1.12
55
flake8>=3.6.0

tests/unit/test_vmware_exporter.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def test_collect_vms():
6262
'datastores': True,
6363
'hosts': True,
6464
'snapshots': True,
65+
'volumes': False,
6566
}
6667

6768
# Test runtime.host not found
@@ -362,6 +363,7 @@ def test_metrics_without_hostaccess():
362363
'datastores': False,
363364
'hosts': False,
364365
'snapshots': False,
366+
'volumes': False,
365367
}
366368

367369
collector = VmwareCollector(
@@ -510,6 +512,7 @@ def test_collect_vm_perf():
510512
'datastores': True,
511513
'hosts': True,
512514
'snapshots': True,
515+
'volumes': False,
513516
}
514517
collector = VmwareCollector(
515518
'127.0.0.1',
@@ -630,6 +633,7 @@ def test_collect_hosts():
630633
'datastores': True,
631634
'hosts': True,
632635
'snapshots': True,
636+
'volumes': False,
633637
}
634638
collector = VmwareCollector(
635639
'127.0.0.1',
@@ -991,6 +995,7 @@ def test_collect_host_perf():
991995
'datastores': False,
992996
'hosts': True,
993997
'snapshots': False,
998+
'volumes': False,
994999
}
9951000
collector = VmwareCollector(
9961001
'127.0.0.1',
@@ -1105,6 +1110,7 @@ def test_collect_datastore():
11051110
'datastores': True,
11061111
'hosts': True,
11071112
'snapshots': True,
1113+
'volumes': False,
11081114
}
11091115
collector = VmwareCollector(
11101116
'127.0.0.1',
@@ -1206,6 +1212,7 @@ def test_collect():
12061212
'datastores': True,
12071213
'hosts': True,
12081214
'snapshots': True,
1215+
'volumes': False,
12091216
}
12101217
collector = VmwareCollector(
12111218
'127.0.0.1',
@@ -1242,6 +1249,7 @@ def test_collect_deferred_error_works():
12421249
'datastores': True,
12431250
'hosts': True,
12441251
'snapshots': True,
1252+
'volumes': False,
12451253
}
12461254
collector = VmwareCollector(
12471255
'127.0.0.1',
@@ -1344,6 +1352,7 @@ def test_vmware_get_inventory():
13441352
'datastores': True,
13451353
'hosts': True,
13461354
'snapshots': True,
1355+
'volumes': False,
13471356
}
13481357
collector = VmwareCollector(
13491358
'127.0.0.1',
@@ -1388,6 +1397,7 @@ def test_vmware_connect():
13881397
'datastores': True,
13891398
'hosts': True,
13901399
'snapshots': True,
1400+
'volumes': False,
13911401
}
13921402
collector = VmwareCollector(
13931403
'127.0.0.1',
@@ -1416,6 +1426,7 @@ def test_vmware_disconnect():
14161426
'datastores': True,
14171427
'hosts': True,
14181428
'snapshots': True,
1429+
'volumes': False,
14191430
}
14201431
collector = VmwareCollector(
14211432
'127.0.0.1',
@@ -1451,6 +1462,7 @@ def test_counter_ids():
14511462
'datastores': True,
14521463
'hosts': True,
14531464
'snapshots': True,
1465+
'volumes': False,
14541466
}
14551467
collector = VmwareCollector(
14561468
'127.0.0.1',
@@ -1607,6 +1619,7 @@ def test_vmware_resource_async_render_GET_section():
16071619
'snapshots': True,
16081620
'vmguests': True,
16091621
'vms': True,
1622+
'volumes': False,
16101623
}
16111624
},
16121625
'mysection': {
@@ -1624,6 +1637,7 @@ def test_vmware_resource_async_render_GET_section():
16241637
'snapshots': True,
16251638
'vmguests': True,
16261639
'vms': True,
1640+
'volumes': False,
16271641
}
16281642
}
16291643
}
@@ -1686,6 +1700,7 @@ def test_config_env_multiple_sections():
16861700
'snapshots': True,
16871701
'vmguests': True,
16881702
'vms': True,
1703+
'volumes': False,
16891704
}
16901705
},
16911706
'mysection': {
@@ -1703,6 +1718,7 @@ def test_config_env_multiple_sections():
17031718
'snapshots': True,
17041719
'vmguests': True,
17051720
'vms': True,
1721+
'volumes': False,
17061722
}
17071723
}
17081724
}

vmware_exporter/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
def get_bool_env(key: str, default: bool):
77
value = os.environ.get(key, default)
8-
return value if value is bool else value.lower() == 'true'
8+
return value if type(value) is bool else value.lower() == 'true'
99

1010

1111
def batch_fetch_properties(content, obj_type, properties):

0 commit comments

Comments
 (0)