Skip to content

Commit 68aa35f

Browse files
author
Dean Troyer
committed
Add unit tests and release note for dns_publish_fixed_ip
Follow-up to https://review.opendev.org/#/c/679834/ which added the options and lacked both a release note and minimal option-handling unit tests. Change-Id: Ibb2820add9b2fedaf5a8b1a77babf043f6641724 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
1 parent b4e9b22 commit 68aa35f

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

openstackclient/tests/unit/network/v2/test_subnet.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,44 @@ def test_create_with_description(self):
460460
self.assertEqual(self.columns, columns)
461461
self.assertItemEqual(self.data, data)
462462

463+
def _test_create_with_dns(self, publish_dns=True):
464+
arglist = [
465+
"--subnet-range", self._subnet.cidr,
466+
"--network", self._subnet.network_id,
467+
self._subnet.name,
468+
]
469+
if publish_dns:
470+
arglist += ['--dns-publish-fixed-ip']
471+
else:
472+
arglist += ['--no-dns-publish-fixed-ip']
473+
verifylist = [
474+
('name', self._subnet.name),
475+
('subnet_range', self._subnet.cidr),
476+
('network', self._subnet.network_id),
477+
('ip_version', self._subnet.ip_version),
478+
('gateway', 'auto'),
479+
]
480+
verifylist.append(('dns_publish_fixed_ip', publish_dns))
481+
482+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
483+
columns, data = (self.cmd.take_action(parsed_args))
484+
485+
self.network.create_subnet.assert_called_once_with(
486+
cidr=self._subnet.cidr,
487+
ip_version=self._subnet.ip_version,
488+
name=self._subnet.name,
489+
network_id=self._subnet.network_id,
490+
dns_publish_fixed_ip=publish_dns,
491+
)
492+
self.assertEqual(self.columns, columns)
493+
self.assertItemEqual(self.data, data)
494+
495+
def test_create_with_dns(self):
496+
self._test_create_with_dns(publish_dns=True)
497+
498+
def test_create_with_no_dns(self):
499+
self._test_create_with_dns(publish_dns=False)
500+
463501
def _test_create_with_tag(self, add_tags=True):
464502
arglist = [
465503
"--subnet-range", self._subnet.cidr,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
features:
3+
- |
4+
Add ``--dns-publish-fixed-ip`` and ``--no-dns-publish-fixed-ip``
5+
options to ``create subnet`` and ``set subnet`` commands to
6+
control the publishing of fixed IPs in DNS when the
7+
``subnet_dns_publish_fixed_ip`` Neutron extension is enabled.
8+
[Bug `1784879 <https://bugs.launchpad.net/neutron/+bug/1784879>`_]

0 commit comments

Comments
 (0)