Skip to content

Commit 60091f0

Browse files
committed
Fixes some 11.6.1 test issues
Issues: Fixes #658 Problem: In 11.6.1, some of the resource endpoints gained a partition prefix and lost a partition attribute. Therefore, those tests would work in versions prior to 11.6.1, but fail afterwards Analysis: The names in version 11.6.1 gained a partition prefix and lost a partition attribute. The tests need to take this into consideration Tests: exiting
1 parent 42b9b81 commit 60091f0

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

test/functional/tm/sys/test_ntp.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# limitations under the License.
1414
#
1515

16+
import pytest
17+
18+
from distutils.version import LooseVersion
1619
from requests.exceptions import HTTPError
1720

1821

@@ -70,8 +73,13 @@ def test_create_base(self, request, mgmt_root):
7073

7174
ntp1 = ntp.restrict.create(name='r1', partition='Common')
7275

73-
assert ntp1.name == 'r1'
74-
assert ntp1.partition == 'Common'
76+
if pytest.config.getoption('--release') < LooseVersion('11.6.1'):
77+
assert ntp1.name == 'r1'
78+
assert ntp1.partition == 'Common'
79+
else:
80+
assert ntp1.name == '/Common/r1'
81+
# The 'partition' attribute was removed in 11.6.1?
82+
7583
assert ntp1.defaultEntry == "disabled"
7684
assert ntp1.ignore == "disabled"
7785
assert ntp1.kod == "disabled"
@@ -114,8 +122,18 @@ def test_create_full(self, request, mgmt_root):
114122
)
115123
ntp1 = ntp.restrict.create(name='r2', partition='Common', **params)
116124

117-
assert ntp1.name == 'r2'
118-
assert ntp1.partition == 'Common'
125+
# In 11.6.1 and later they started prepending the partition name
126+
# to the name attribute here. So we handle this case for our tests.
127+
#
128+
# According to Narendra, they should always have behaved this way
129+
# so this must have been a bugfix
130+
if pytest.config.getoption('--release') < LooseVersion('11.6.1'):
131+
assert ntp1.name == 'r2'
132+
assert ntp1.partition == 'Common'
133+
else:
134+
assert ntp1.name == '/Common/r2'
135+
# The 'partition' attribute was removed in 11.6.1?
136+
119137
assert ntp1.address == "192.168.1.0"
120138
assert ntp1.defaultEntry == "enabled"
121139
assert ntp1.ignore == "enabled"

test/functional/tm/sys/test_snmp.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,17 @@ def test_community_create_refresh_update_delete_load(
338338
)
339339

340340
assert comm1.communityName == 'commtest1'
341-
assert comm1.name == 'commtest1'
341+
342+
# In 11.6.1 and later they started prepending the partition name
343+
# to the name attribute here. So we handle this case for our tests.
344+
#
345+
# According to Narendra, they should always have behaved this way
346+
# so this must have been a bugfix
347+
if pytest.config.getoption('--release') < LooseVersion('11.6.1'):
348+
assert comm1.name == 'commtest1'
349+
else:
350+
assert comm1.name == '/Common/commtest1'
351+
342352
assert comm1.access == 'ro'
343353
assert comm1.ipv6 == 'disabled'
344354

0 commit comments

Comments
 (0)