Commit 970dd4d4 authored by Ayush Tiwari's avatar Ayush Tiwari

Update tests

parent 36da1c49
......@@ -16,8 +16,8 @@ from slapos.recipe.gitclone import GIT_CLONE_ERROR_MESSAGE, \
optionflags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)
GIT_REPOSITORY = 'http://git.erp5.org/repos/slapos.recipe.build.git'
BAD_GIT_REPOSITORY = 'http://git.erp5.org/repos/nowhere'
GIT_SUBMODULE_REPOSITORY = 'https://lab.nexedi.com/tiwariayush/test_erp5_submodule'
REVISION = '2566127'
def setUp(test):
......@@ -34,6 +34,8 @@ class GitCloneNonInformativeTests(unittest.TestCase):
def setUp(self):
self.dir = os.path.realpath(tempfile.mkdtemp())
self.parts_directory_path = os.path.join(self.dir, 'test_parts')
def setUpSubmoduleRepo(self):
# Create a main repo as well as a submodule repo
# Add files in both main as well as submodule repo
subprocess.check_call('mkdir main_repo', cwd=self.dir, shell=True)
......@@ -119,7 +121,7 @@ class GitCloneNonInformativeTests(unittest.TestCase):
}
}
default_options = {
'repository': self.project_dir
'repository': GIT_REPOSITORY
}
default_options.update(**options)
return Recipe(bo, 'test', default_options)
......@@ -154,7 +156,7 @@ class GitCloneNonInformativeTests(unittest.TestCase):
self.assertTrue(os.path.exists(git_repository_path))
self.assertFalse(os.path.exists(bad_file_path), "pyc file not removed")
def test_clone_and_udpate_submodule(self):
def test_01_clone_and_udpate_submodule(self):
"""
STEP I:
Repositories status: Main repo(M1) and Submodule repo (S1)
......@@ -171,6 +173,7 @@ class GitCloneNonInformativeTests(unittest.TestCase):
Main repo (M3) ---references---> Submodule(S2)
Install should be M3+S2
"""
self.setUpSubmoduleRepo()
# STEP I: Clone repositories in status M1 and S1 (M1---->S1)
recipe = self.makeGitCloneRecipe(
{
......@@ -267,7 +270,7 @@ class GitCloneNonInformativeTests(unittest.TestCase):
}
}
options = {
'repository': self.project_dir,
'repository': GIT_REPOSITORY,
"ignore-ssl-certificate": str(ignore_ssl_certificate).lower(),
}
recipe = slapos.recipe.gitclone.Recipe(bo, 'test', options)
......@@ -285,6 +288,7 @@ class GitCloneNonInformativeTests(unittest.TestCase):
self.test_ignore_ssl_certificate(ignore_ssl_certificate=False)
def test_clone_submodules_by_default(self, ignore_cloning_submodules=False):
self.setUpSubmoduleRepo()
recipe = self.makeGitCloneRecipe(
{'repository': self.project_dir,
'ignore-cloning-submodules': str(ignore_cloning_submodules).lower()}
......@@ -309,6 +313,7 @@ class GitCloneNonInformativeTests(unittest.TestCase):
should udpate the main repo as well as submodule repo if the reference of
submodule in main repo has been udpated.
"""
self.setUpSubmoduleRepo()
recipe = self.makeGitCloneRecipe(
{'repository': self.project_dir}
)
......@@ -341,7 +346,7 @@ class GitCloneNonInformativeTests(unittest.TestCase):
# Make another git clone of submodule and check the HEAD of the repo.
submodule_recipe = self.makeGitCloneRecipe(
{'repository': GIT_SUBMODULE_REPOSITORY}
{'repository': self.submodule_dir}
)
submodule_recipe.install()
# Check the HEAD of the submodule
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment