From 6a5a2d0f6fe461d21d9945ed17a875a1e91c297b Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 20 Oct 2022 14:47:44 -0700 Subject: [PATCH] Fix test_ensure_cloned and JWT tests This is two changes in one since they both fix breakage due to external dep changes: Git no longer allows file urls in submodules by default, but one of our unit tests relied on that behavior (in order to verify that we can clone repos with submodules). Run the submodule add command in the test with a flag which allows file urls. Pin PyJWT <2.6.0 2.6.0 causes the following error: 2022-10-20 15:58:04,800 cherrypy.error.140001002710128 ERROR [req: 86efa7775e88473a9e9d5e54f0c83050] [20/Oct/2022:15:58:04] HTTP Traceback (most recent call last): File "/home/corvus/git/zuul/zuul/.tox/py310/lib/python3.10/site-packages/cherrypy/_cprequest.py", line 638, in respond self._do_respond(path_info) File "/home/corvus/git/zuul/zuul/.tox/py310/lib/python3.10/site-packages/cherrypy/_cprequest.py", line 702, in _do_respond response.finalize() File "/home/corvus/git/zuul/zuul/.tox/py310/lib/python3.10/site-packages/cherrypy/_cprequest.py", line 901, in finalize content = self.collapse_body() File "/home/corvus/git/zuul/zuul/.tox/py310/lib/python3.10/site-packages/cherrypy/_cprequest.py", line 859, in collapse_body new_body = b''.join(self.body) File "/home/corvus/git/zuul/zuul/.tox/py310/lib/python3.10/site-packages/cherrypy/_json.py", line 24, in encode for chunk in _encode(value): File "/usr/lib/python3.10/json/encoder.py", line 431, in _iterencode yield from _iterencode_dict(o, _current_indent_level) File "/usr/lib/python3.10/json/encoder.py", line 405, in _iterencode_dict yield from chunks File "/usr/lib/python3.10/json/encoder.py", line 438, in _iterencode o = _default(o) File "/usr/lib/python3.10/json/encoder.py", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type ImmatureSignatureError is not JSON serializable Change-Id: I2e345f24ea0a62ce8d9dbe1c066438f194e7075c --- requirements.txt | 2 +- tests/unit/test_merger_repo.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 408dcbbbdd..88eed57cd0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,7 +23,7 @@ alembic cryptography>=1.6 cachecontrol<0.12.7 cachetools -pyjwt>=2.0.0,<3.0 +pyjwt>=2.0.0,<2.6.0 iso8601 psutil fb-re2>=1.0.6 diff --git a/tests/unit/test_merger_repo.py b/tests/unit/test_merger_repo.py index 64d0a3098c..182dea1201 100644 --- a/tests/unit/test_merger_repo.py +++ b/tests/unit/test_merger_repo.py @@ -71,8 +71,11 @@ class TestMergerRepo(ZuulTestCase): # Forge a repo having a submodule parent_repo = git.Repo(parent_path) - parent_repo.git.submodule('add', os.path.join( - self.upstream_root, 'org/project2'), 'subdir') + parent_repo.git(c='protocol.file.allow=always').submodule( + 'add', + os.path.join(self.upstream_root, 'org/project2'), + 'subdir') + parent_repo.index.commit('Adding project2 as a submodule in subdir') # git 1.7.8 changed .git from being a directory to a file pointing # to the parent repository /.git/modules/*