2021-01-08 13:41:50 +01:00
|
|
|
From 9cb1618a66e691d2cc53edcf64f475e829e701a5 Mon Sep 17 00:00:00 2001
|
2019-11-28 16:41:55 +01:00
|
|
|
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
|
|
|
|
<psuarezhernandez@suse.com>
|
|
|
|
Date: Wed, 27 Nov 2019 15:41:57 +0000
|
|
|
|
Subject: [PATCH] Prevent test_mod_del_repo_multiline_values to fail
|
|
|
|
|
|
|
|
---
|
2021-01-08 13:41:50 +01:00
|
|
|
tests/integration/modules/test_pkg.py | 28 +++++++++++++++++++++------
|
|
|
|
1 file changed, 22 insertions(+), 6 deletions(-)
|
2019-11-28 16:41:55 +01:00
|
|
|
|
|
|
|
diff --git a/tests/integration/modules/test_pkg.py b/tests/integration/modules/test_pkg.py
|
2021-01-08 13:41:50 +01:00
|
|
|
index e32013800d..3ece73074b 100644
|
2019-11-28 16:41:55 +01:00
|
|
|
--- a/tests/integration/modules/test_pkg.py
|
|
|
|
+++ b/tests/integration/modules/test_pkg.py
|
2021-01-08 13:41:50 +01:00
|
|
|
@@ -179,17 +179,30 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
|
2019-11-28 16:41:55 +01:00
|
|
|
enabled=enabled,
|
|
|
|
failovermethod=failovermethod,
|
|
|
|
)
|
|
|
|
- # return data from pkg.mod_repo contains the file modified at
|
|
|
|
- # the top level, so use next(iter(ret)) to get that key
|
|
|
|
self.assertNotEqual(ret, {})
|
|
|
|
- repo_info = ret[next(iter(ret))]
|
|
|
|
+ repo_info = {repo: ret}
|
|
|
|
self.assertIn(repo, repo_info)
|
2021-01-08 13:41:50 +01:00
|
|
|
- self.assertEqual(repo_info[repo]["baseurl"], my_baseurl)
|
|
|
|
+ if os_grain == "SUSE":
|
|
|
|
+ self.assertEqual(
|
|
|
|
+ repo_info[repo]["baseurl"], expected_get_repo_baseurl_zypp
|
|
|
|
+ )
|
2019-11-28 16:41:55 +01:00
|
|
|
+ else:
|
2021-01-08 13:41:50 +01:00
|
|
|
+ self.assertEqual(repo_info[repo]["baseurl"], my_baseurl)
|
|
|
|
ret = self.run_function("pkg.get_repo", [repo])
|
|
|
|
- self.assertEqual(ret["baseurl"], expected_get_repo_baseurl)
|
|
|
|
+ if os_grain == "SUSE":
|
|
|
|
+ self.assertEqual(
|
|
|
|
+ repo_info[repo]["baseurl"], expected_get_repo_baseurl_zypp
|
|
|
|
+ )
|
2019-11-28 16:41:55 +01:00
|
|
|
+ else:
|
2021-01-08 13:41:50 +01:00
|
|
|
+ self.assertEqual(ret["baseurl"], expected_get_repo_baseurl)
|
|
|
|
self.run_function("pkg.mod_repo", [repo])
|
|
|
|
ret = self.run_function("pkg.get_repo", [repo])
|
|
|
|
- self.assertEqual(ret["baseurl"], expected_get_repo_baseurl)
|
|
|
|
+ if os_grain == "SUSE":
|
|
|
|
+ self.assertEqual(
|
|
|
|
+ repo_info[repo]["baseurl"], expected_get_repo_baseurl_zypp
|
|
|
|
+ )
|
2019-11-28 16:41:55 +01:00
|
|
|
+ else:
|
2021-01-08 13:41:50 +01:00
|
|
|
+ self.assertEqual(ret["baseurl"], expected_get_repo_baseurl)
|
2019-11-28 16:41:55 +01:00
|
|
|
finally:
|
|
|
|
if repo is not None:
|
2021-01-08 13:41:50 +01:00
|
|
|
self.run_function("pkg.del_repo", [repo])
|
|
|
|
@@ -205,6 +218,9 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
|
|
|
|
my_baseurl = (
|
|
|
|
"http://my.fake.repo/foo/bar/\n http://my.fake.repo.alt/foo/bar/"
|
|
|
|
)
|
|
|
|
+ expected_get_repo_baseurl_zypp = (
|
|
|
|
+ "http://my.fake.repo/foo/bar/%0A%20http://my.fake.repo.alt/foo/bar/"
|
|
|
|
+ )
|
|
|
|
expected_get_repo_baseurl = (
|
|
|
|
"http://my.fake.repo/foo/bar/\nhttp://my.fake.repo.alt/foo/bar/"
|
|
|
|
)
|
2019-11-28 16:41:55 +01:00
|
|
|
--
|
2021-01-08 13:41:50 +01:00
|
|
|
2.29.2
|
2019-11-28 16:41:55 +01:00
|
|
|
|
|
|
|
|