tests: Check patches can still be applied after switching refspec
Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
79bfe5a04d
commit
23277836c4
@ -39,3 +39,21 @@ def test_patch(tmpdir):
|
||||
assert os.stat(f)[stat.ST_MODE] & stat.S_IXUSR
|
||||
kas.kas(['shell', 'test.yml', '-c', 'true'])
|
||||
os.chdir(prev_dir)
|
||||
|
||||
def test_patch_update(tmpdir):
|
||||
"""
|
||||
Test that patches are applied correctly after switching refspec from
|
||||
a branch to a commit hash and vice-versa with both git and mercurial
|
||||
repositories.
|
||||
"""
|
||||
tdir = str(tmpdir.mkdir('test_patch_update'))
|
||||
shutil.rmtree(tdir, ignore_errors=True)
|
||||
print(os.getcwd())
|
||||
shutil.copytree('tests/test_patch', tdir)
|
||||
prev_dir = os.path.realpath(os.getcwd())
|
||||
os.chdir(tdir)
|
||||
kas.kas(['shell', 'test.yml', '-c', 'true'])
|
||||
kas.kas(['shell', 'test2.yml', '-c', 'true'])
|
||||
for f in ['kas/tests/test_patch/hello.sh', 'hello/hello.sh']:
|
||||
assert os.stat(f)[stat.ST_MODE] & stat.S_IXUSR
|
||||
os.chdir(prev_dir)
|
||||
|
45
tests/test_patch/test2.yml
Normal file
45
tests/test_patch/test2.yml
Normal file
@ -0,0 +1,45 @@
|
||||
header:
|
||||
version: 8
|
||||
|
||||
repos:
|
||||
this:
|
||||
|
||||
kas:
|
||||
url: https://github.com/siemens/kas.git
|
||||
refspec: master
|
||||
patches:
|
||||
plain:
|
||||
repo: this
|
||||
path: patches/kas-branch/003.patch
|
||||
|
||||
kas-branch:
|
||||
url: https://github.com/siemens/kas.git
|
||||
refspec: 907816a5c4094b59a36aec12226e71c461c05b77
|
||||
patches:
|
||||
plain:
|
||||
repo: this
|
||||
path: patches/kas/001.patch
|
||||
quilt:
|
||||
repo: this
|
||||
path: patches/kas/quilt/
|
||||
|
||||
hello:
|
||||
url: https://www.mercurial-scm.org/repo/hello/
|
||||
refspec: default
|
||||
type: hg
|
||||
patches:
|
||||
plain:
|
||||
repo: this
|
||||
path: patches/hello/001.patch
|
||||
quilt:
|
||||
repo: this
|
||||
path: patches/hello/quilt/
|
||||
|
||||
hello-branch:
|
||||
url: https://www.mercurial-scm.org/repo/hello/
|
||||
refspec: 0a04b987be5a
|
||||
type: hg
|
||||
patches:
|
||||
plain:
|
||||
repo: this
|
||||
path: patches/hello-branch/003.patch
|
Loading…
Reference in New Issue
Block a user