Fix wrong/bad/buggy waiting logic

This commit is contained in:
Pedro Algarvio 2020-04-20 02:21:49 +01:00
parent 5ed944ab07
commit 004278508c
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF

View file

@ -39,18 +39,21 @@ class LoaderGrainsTest(ModuleCase):
# before trying to get the grains. This test may execute before the
# minion has finished syncing down the files it needs.
module = os.path.join(
RUNTIME_VARS.TMP,
"rootdir",
"cache",
RUNTIME_VARS.RUNTIME_CONFIGS["minion"]["cachedir"],
"files",
"base",
"_grains",
"test_custom_grain2.py",
"custom_grain2.py",
)
tries = 0
while not os.path.exists(module):
tries += 1
if tries > 60:
self.fail(
"Failed to found custom grains module in cache path {}".format(
module
)
)
break
time.sleep(1)
grains = self.run_function("grains.items")