From 1e3dc48c64304eb378660ceb531aab3d42ac0710 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Sat, 28 Jan 2017 07:18:45 -0600 Subject: [PATCH] Add relnotes for the two recent bug fixes Also add a functional test for network create --project Change-Id: Idbfdf82f1ea6c84fb6a51df88e746e5ddb896b4f --- .../functional/network/v2/test_network.py | 72 +++++++++++++++++++ .../notes/bug-1659878-f6a55b7166d99ca8.yaml | 7 ++ .../notes/bug-1659993-a5fe43bef587e490.yaml | 6 ++ 3 files changed, 85 insertions(+) create mode 100644 releasenotes/notes/bug-1659878-f6a55b7166d99ca8.yaml create mode 100644 releasenotes/notes/bug-1659993-a5fe43bef587e490.yaml diff --git a/openstackclient/tests/functional/network/v2/test_network.py b/openstackclient/tests/functional/network/v2/test_network.py index c55d70f9af..1f7b7c9e6e 100644 --- a/openstackclient/tests/functional/network/v2/test_network.py +++ b/openstackclient/tests/functional/network/v2/test_network.py @@ -19,6 +19,78 @@ from openstackclient.tests.functional import base class NetworkTests(base.TestCase): """Functional tests for network""" + def test_network_create(self): + """Test create options, delete""" + # Get project IDs + cmd_output = json.loads(self.openstack('token issue -f json ')) + auth_project_id = cmd_output['project_id'] + + cmd_output = json.loads(self.openstack('project list -f json ')) + admin_project_id = None + demo_project_id = None + for p in cmd_output: + if p['Name'] == 'admin': + admin_project_id = p['ID'] + if p['Name'] == 'demo': + demo_project_id = p['ID'] + + # Verify assumptions: + # * admin and demo projects are present + # * demo and admin are distinct projects + # * tests run as admin + self.assertIsNotNone(admin_project_id) + self.assertIsNotNone(demo_project_id) + self.assertNotEqual(admin_project_id, demo_project_id) + self.assertEqual(admin_project_id, auth_project_id) + + # network create with no options + name1 = uuid.uuid4().hex + cmd_output = json.loads(self.openstack( + 'network create -f json ' + + name1 + )) + self.addCleanup(self.openstack, 'network delete ' + name1) + self.assertIsNotNone(cmd_output["id"]) + + # Check the default values + self.assertEqual( + admin_project_id, + cmd_output["project_id"], + ) + self.assertEqual( + '', + cmd_output["description"], + ) + self.assertEqual( + 'UP', + cmd_output["admin_state_up"], + ) + self.assertEqual( + False, + cmd_output["shared"], + ) + self.assertEqual( + 'Internal', + cmd_output["router:external"], + ) + + name2 = uuid.uuid4().hex + cmd_output = json.loads(self.openstack( + 'network create -f json ' + + '--project demo ' + + name2 + )) + self.addCleanup(self.openstack, 'network delete ' + name2) + self.assertIsNotNone(cmd_output["id"]) + self.assertEqual( + demo_project_id, + cmd_output["project_id"], + ) + self.assertEqual( + '', + cmd_output["description"], + ) + def test_network_delete(self): """Test create, delete multiple""" name1 = uuid.uuid4().hex diff --git a/releasenotes/notes/bug-1659878-f6a55b7166d99ca8.yaml b/releasenotes/notes/bug-1659878-f6a55b7166d99ca8.yaml new file mode 100644 index 0000000000..f7932a6688 --- /dev/null +++ b/releasenotes/notes/bug-1659878-f6a55b7166d99ca8.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + The ``network create`` command was ignoring the ``--project`` option and + creating networks owned by the current authenticated user's project. This + was a regression introduced in OSC 3.8.0. + [Bug `1659878 `_] diff --git a/releasenotes/notes/bug-1659993-a5fe43bef587e490.yaml b/releasenotes/notes/bug-1659993-a5fe43bef587e490.yaml new file mode 100644 index 0000000000..db2349b510 --- /dev/null +++ b/releasenotes/notes/bug-1659993-a5fe43bef587e490.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + The ``address scope list`` command failed with 'HttpException: Bad Request' + when the ``--share`` or ``--no-share`` options were used. + [Bug `1659993 `_]