SHA256
1
0
forked from pool/salt
salt/fix-git_pillar-merging-across-multiple-__env__-repos.patch

87 lines
2.7 KiB
Diff
Raw Normal View History

From f5c9527aeee190a66a908037770c80a75e911d8c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Tue, 6 Nov 2018 16:38:54 +0000
Subject: [PATCH] Fix git_pillar merging across multiple __env__
repositories (bsc#1112874)
Resolve target branch when using __env__
Test git ext_pillar across multiple repos using __env__
Remove unicode references
---
tests/integration/pillar/test_git_pillar.py | 55 +++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/tests/integration/pillar/test_git_pillar.py b/tests/integration/pillar/test_git_pillar.py
index c0362127f6..979dfebb94 100644
--- a/tests/integration/pillar/test_git_pillar.py
+++ b/tests/integration/pillar/test_git_pillar.py
@@ -1600,6 +1600,61 @@ class TestPygit2SSH(GitPillarSSHTestBase):
},
)
+
+@skipIf(NO_MOCK, NO_MOCK_REASON)
+@skipIf(_windows_or_mac(), "minion is windows or mac")
+@skip_if_not_root
+@skipIf(
+ not HAS_PYGIT2,
+ "pygit2 >= {} and libgit2 >= {} required".format(PYGIT2_MINVER, LIBGIT2_MINVER),
+)
+@skipIf(not HAS_NGINX, "nginx not present")
+@skipIf(not HAS_VIRTUALENV, "virtualenv not present")
+class TestPygit2HTTP(GitPillarHTTPTestBase):
+ """
+ Test git_pillar with pygit2 using SSH authentication
+ """
+
+ def test_single_source(self):
+ """
+ Test with git_pillar_includes enabled and using "__env__" as the branch
+ name for the configured repositories.
+ The "gitinfo" repository contains top.sls file with a local reference
+ and also referencing external "nowhere.foo" which is provided by "webinfo"
+ repository mounted as "nowhere".
+ """
+ ret = self.get_pillar(
+ """\
+ file_ignore_regex: []
+ file_ignore_glob: []
+ git_pillar_provider: pygit2
+ git_pillar_pubkey: {pubkey_nopass}
+ git_pillar_privkey: {privkey_nopass}
+ cachedir: {cachedir}
+ extension_modules: {extmods}
+ ext_pillar:
+ - git:
+ - __env__ {url_extra_repo}:
+ - name: gitinfo
+ - __env__ {url}:
+ - name: webinfo
+ - mountpoint: nowhere
+ """
+ )
+ self.assertEqual(
+ ret,
+ {
+ "branch": "master",
+ "motd": "The force will be with you. Always.",
+ "mylist": ["master"],
+ "mydict": {
+ "master": True,
+ "nested_list": ["master"],
+ "nested_dict": {"master": True},
+ },
+ },
+ )
+
@slowTest
def test_root_parameter(self):
"""
--
2.29.2