-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathtest_configpush_shard_check.py
More file actions
56 lines (52 loc) · 1.75 KB
/
test_configpush_shard_check.py
File metadata and controls
56 lines (52 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import pytest
import logging
import importlib
from helpers.utils import read_data
script = importlib.import_module("aci-preupgrade-validation-script")
log = logging.getLogger(__name__)
dir = os.path.dirname(os.path.abspath(__file__))
# icurl queries
configpushShardCont_api = 'configpushShardCont.json'
configpushShardCont_api += '?query-target-filter=or(ne(configpushShardCont.tailTx,"0"),ne(configpushShardCont.headTx,"0"))'
@pytest.mark.parametrize(
"icurl_outputs, tversion, expected_result",
[
# tversion not given
(
{configpushShardCont_api: []},
None,
script.MANUAL,
),
# Non-fixed Versions
(
# affected tversion, configpushShardCont_api has non-zero headTx / tailTx
{configpushShardCont_api: read_data(dir, "configpushShardCont_pos.json")},
"6.0(3a)",
script.FAIL_O,
),
(
# affected tversion, all configpushShardCont_api tx are 0
{configpushShardCont_api: []},
"5.2(6a)",
script.PASS,
),
# Fixed Versions
(
# non-affected tversion, configpushShardCont_api has non-zero headTx / tailTx
{configpushShardCont_api: read_data(dir, "configpushShardCont_pos.json")},
"6.1(6b)",
script.NA,
),
(
# non-affected tversion, all configpushShardCont_api tx are 0
{configpushShardCont_api: []},
"6.1(4b)",
script.NA,
),
],
)
def test_logic(mock_icurl, tversion, expected_result):
tversion = script.AciVersion(tversion) if tversion else None
result = script.configpush_shard_check(1, 1, tversion)
assert result == expected_result