From 63dbab87df5ba3307de886f8c76bda2ba6c59719 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Thu, 18 Jan 2018 13:18:34 -0800 Subject: [PATCH] Fix node data retrieval race in test_failed_provider Once we start deleting nodes in test_failed_provider we can't count on getNode() giving us a node for a previous request because that node may have been deleted. Check that node is a valid value before accessing its provider value to avoid this race. Change-Id: Ie6b20f1a66de7865223a7ecf5785e2446afc7804 --- nodepool/tests/test_launcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodepool/tests/test_launcher.py b/nodepool/tests/test_launcher.py index 77f19ff50..156662ff1 100644 --- a/nodepool/tests/test_launcher.py +++ b/nodepool/tests/test_launcher.py @@ -976,7 +976,7 @@ class TestLauncher(tests.DBTestCase): provider2_second = None nodes = map(pool.zk.getNode, pool.zk.getNodes()) for node in nodes: - if node.provider == 'fake-provider2': + if node and node.provider == 'fake-provider2': provider2_second = node # Now delete the new node we had provider2 build. At this point