Merge ~pappacena/turnip:scenario-tests into turnip:master

Proposed by Thiago F. Pappacena
Status: Merged
Approved by: Thiago F. Pappacena
Approved revision: 32399f98b84c918aa8fc5b6b540c507d6ef4bbe6
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~pappacena/turnip:scenario-tests
Merge into: turnip:master
Diff against target: 89 lines (+22/-3)
3 files modified
requirements.txt (+3/-2)
setup.py (+1/-0)
turnip/pack/tests/test_functional.py (+18/-1)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+389085@code.launchpad.net

Commit message

Test scenario to ensure compatibility with both v1 and v2 git protocols

Description of the change

Even when a git client announces that it wants to use v2 protocol, the git server can announce that it's not compatible with v2 and the client falls back to v1. So, it should be safe to have our test suite running tests for both v1 and v2 on all frontends, and we implement v2 compatibility as separated steps.

To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

There is a backported git package in this PPA: https://launchpad.net/~pappacena/+archive/ubuntu/launchpad-ppa/+packages

The git package in that PPA should be part of this review, but it's basically the result of the following command:
$ backportpackage --upload=ppa:pappacena/launchpad-ppa -d bionic -s focal git

Revision history for this message
Colin Watson (cjwatson) wrote :

Your git backport looks fine; I've copied it into ppa:launchpad/ubuntu/ppa.

review: Approve
~pappacena/turnip:scenario-tests updated
f620267... by Thiago F. Pappacena

Running v0 protocol tests

Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

Added the requested changes. Top-approving this MP.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/requirements.txt b/requirements.txt
2index 89895ea..26ff7da 100644
3--- a/requirements.txt
4+++ b/requirements.txt
5@@ -39,7 +39,7 @@ mock==3.0.5; python_version < "3"
6 pathlib2==2.3.5
7 Paste==2.0.2
8 PasteDeploy==2.1.0
9-pbr==5.4.4
10+pbr==5.4.5
11 pep8==1.5.7
12 psutil==5.7.0
13 pyasn1==0.4.8
14@@ -60,7 +60,8 @@ scandir==1.10.0
15 setuptools-scm==1.17.0
16 simplejson==3.6.5
17 six==1.14.0
18-testtools==2.3.0
19+testscenarios==0.5.0
20+testtools==2.4.0
21 traceback2==1.4.0
22 translationstring==1.3
23 Twisted[conch]==20.3.0
24diff --git a/setup.py b/setup.py
25index 76bf6c2..44507da 100755
26--- a/setup.py
27+++ b/setup.py
28@@ -37,6 +37,7 @@ test_requires = [
29 'fixtures',
30 'flake8',
31 'mock; python_version < "3"',
32+ 'testscenarios',
33 'testtools',
34 'webtest',
35 ]
36diff --git a/turnip/pack/tests/test_functional.py b/turnip/pack/tests/test_functional.py
37index d6aaa7f..c6f688d 100644
38--- a/turnip/pack/tests/test_functional.py
39+++ b/turnip/pack/tests/test_functional.py
40@@ -35,6 +35,7 @@ from fixtures import (
41 TempDir,
42 )
43 from pygit2 import GIT_OID_HEX_ZERO
44+from testscenarios import WithScenarios
45 from testtools import TestCase
46 from testtools.content import text_content
47 from testtools.deferredruntest import AsynchronousDeferredRunTest
48@@ -77,10 +78,16 @@ from turnip.pack.tests.fake_servers import (
49 from turnip.version_info import version_info
50
51
52-class FunctionalTestMixin(object):
53+class FunctionalTestMixin(WithScenarios):
54
55 run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=30)
56
57+ scenarios = [
58+ ('v0 protocol', {"protocol_version": b"0"}),
59+ ('v1 protocol', {"protocol_version": b"1"}),
60+ ('v2 protocol', {"protocol_version": b"2"}),
61+ ]
62+
63 def startVirtInfo(self):
64 # Set up a fake virt information XML-RPC server which just
65 # maps paths to their SHA-256 hash.
66@@ -120,6 +127,11 @@ class FunctionalTestMixin(object):
67
68 @defer.inlineCallbacks
69 def assertCommandSuccess(self, command, path='.'):
70+ if command[0] == b'git':
71+ args = list(command[1:])
72+ command = [
73+ b'git', b'-c', b'protocol.version=%s' % self.protocol_version
74+ ] + args
75 out, err, code = yield utils.getProcessOutputAndValue(
76 command[0], command[1:], env=os.environ, path=path)
77 if code != 0:
78@@ -130,6 +142,11 @@ class FunctionalTestMixin(object):
79
80 @defer.inlineCallbacks
81 def assertCommandFailure(self, command, path='.'):
82+ if command[0] == b'git':
83+ args = list(command[1:])
84+ command = [
85+ b'git', b'-c', b'protocol.version=%s' % self.protocol_version
86+ ] + args
87 out, err, code = yield utils.getProcessOutputAndValue(
88 command[0], command[1:], env=os.environ, path=path)
89 if code == 0:

Subscribers

People subscribed via source and target branches