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>
This commit is contained in:
Dean Troyer 2020-01-13 11:13:42 -06:00
parent b4e9b225b4
commit 68aa35f35f
2 changed files with 46 additions and 0 deletions

View File

@ -460,6 +460,44 @@ class TestCreateSubnet(TestSubnet):
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
def _test_create_with_dns(self, publish_dns=True):
arglist = [
"--subnet-range", self._subnet.cidr,
"--network", self._subnet.network_id,
self._subnet.name,
]
if publish_dns:
arglist += ['--dns-publish-fixed-ip']
else:
arglist += ['--no-dns-publish-fixed-ip']
verifylist = [
('name', self._subnet.name),
('subnet_range', self._subnet.cidr),
('network', self._subnet.network_id),
('ip_version', self._subnet.ip_version),
('gateway', 'auto'),
]
verifylist.append(('dns_publish_fixed_ip', publish_dns))
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = (self.cmd.take_action(parsed_args))
self.network.create_subnet.assert_called_once_with(
cidr=self._subnet.cidr,
ip_version=self._subnet.ip_version,
name=self._subnet.name,
network_id=self._subnet.network_id,
dns_publish_fixed_ip=publish_dns,
)
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
def test_create_with_dns(self):
self._test_create_with_dns(publish_dns=True)
def test_create_with_no_dns(self):
self._test_create_with_dns(publish_dns=False)
def _test_create_with_tag(self, add_tags=True):
arglist = [
"--subnet-range", self._subnet.cidr,

View File

@ -0,0 +1,8 @@
---
features:
- |
Add ``--dns-publish-fixed-ip`` and ``--no-dns-publish-fixed-ip``
options to ``create subnet`` and ``set subnet`` commands to
control the publishing of fixed IPs in DNS when the
``subnet_dns_publish_fixed_ip`` Neutron extension is enabled.
[Bug `1784879 <https://bugs.launchpad.net/neutron/+bug/1784879>`_]