From c901620a036c31d71b2108c51431d53a9eb0dad9 Mon Sep 17 00:00:00 2001
From: Dean Troyer <dtroyer@gmail.com>
Date: Wed, 18 Oct 2017 14:01:12 -0500
Subject: [PATCH] Attempt to de-race qos policy

We're getting about 1-in-6 failures on qos policy delete now, with the message
that the policy is in use by a network.  It shouldn't be, this is possibly
due to the small window where the policy is set as the default.  Let's
remove that and shore up the test using --share instead.

Change-Id: I8d669bd3c5c88dadd2927aee89e5ef72cf4001c4
---
 .../functional/network/v2/test_network_qos_policy.py   | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/openstackclient/tests/functional/network/v2/test_network_qos_policy.py b/openstackclient/tests/functional/network/v2/test_network_qos_policy.py
index fc36f49032..02e6402802 100644
--- a/openstackclient/tests/functional/network/v2/test_network_qos_policy.py
+++ b/openstackclient/tests/functional/network/v2/test_network_qos_policy.py
@@ -66,7 +66,6 @@ class NetworkQosPolicyTests(common.NetworkTests):
         self.openstack(
             'network qos policy set ' +
             '--share ' +
-            '--default ' +
             policy_name
         )
 
@@ -75,11 +74,16 @@ class NetworkQosPolicyTests(common.NetworkTests):
             policy_name
         ))
         self.assertTrue(json_output['shared'])
-        self.assertTrue(json_output['is_default'])
 
-        self.openstack('network qos policy set --no-default ' + policy_name)
+        self.openstack(
+            'network qos policy set ' +
+            '--no-share ' +
+            '--no-default ' +
+            policy_name
+        )
         json_output = json.loads(self.openstack(
             'network qos policy show -f json ' +
             policy_name
         ))
+        self.assertFalse(json_output['shared'])
         self.assertFalse(json_output['is_default'])