Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.recipe.build
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.recipe.build
Commits
de170a56
Commit
de170a56
authored
Jan 18, 2019
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add check for update method call
parent
468f3883
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
7 deletions
+41
-7
slapos/recipe/build/tests.py
slapos/recipe/build/tests.py
+41
-7
No files found.
slapos/recipe/build/tests.py
View file @
de170a56
...
...
@@ -132,6 +132,11 @@ class GitCloneNonInformativeTests(unittest.TestCase):
def
touch
(
self
,
*
parts
):
os
.
close
(
os
.
open
(
os
.
path
.
join
(
*
parts
),
os
.
O_CREAT
,
0o666
))
def
echo
(
self
,
path
,
line
):
myFile
=
open
(
path
,
'w'
)
myFile
.
write
(
line
)
myFile
.
close
()
def
makeGitCloneRecipe
(
self
,
options
):
from
slapos.recipe.gitclone
import
Recipe
bo
=
{
...
...
@@ -177,7 +182,8 @@ class GitCloneNonInformativeTests(unittest.TestCase):
self
.
assertFalse
(
os
.
path
.
exists
(
bad_file_path
),
"pyc file not removed"
)
@
with_buildout
def
test_clone_and_udpate_submodule
(
self
,
buildout
,
write
,
sample_buildout
,
**
kw
):
def
test_clone_and_update_submodule
(
self
,
buildout
,
write
,
sample_buildout
,
**
kw
):
"""
STEP I:
Repositories status: Main repo(M1) and Submodule repo (S1)
...
...
@@ -219,6 +225,29 @@ repository = %s
head_commit_submodule_after_clone
=
self
.
getRepositoryHeadCommit
(
submodule_repo_path
)
# Add a marker file in parent as well as submodule repo
parent_local_change_path
=
os
.
path
.
join
(
main_repo_path
,
'local_change_main'
)
submodule_local_change_path
=
os
.
path
.
join
(
submodule_repo_path
,
'local_change_submodule'
)
self
.
echo
(
parent_local_change_path
,
'foo'
)
self
.
echo
(
submodule_local_change_path
,
'bar'
)
# Check if the file are created at the expected position and check contents
self
.
assertTrue
(
os
.
path
.
exists
(
parent_local_change_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
submodule_local_change_path
))
self
.
assertEqual
(
check_output
([
'cat'
,
parent_local_change_path
]),
'foo'
)
self
.
assertEqual
(
check_output
([
'cat'
,
submodule_local_change_path
]),
'bar'
)
# Update buildout
check_call
([
buildout
])
# The local changes should be still there
self
.
assertTrue
(
os
.
path
.
exists
(
parent_local_change_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
submodule_local_change_path
))
self
.
assertEqual
(
check_output
([
'cat'
,
parent_local_change_path
]),
'foo'
)
self
.
assertEqual
(
check_output
([
'cat'
,
submodule_local_change_path
]),
'bar'
)
# Update submodule repository and main repo separately
self
.
touch
(
self
.
project_dir
,
'file2.py'
)
self
.
gitAdd
(
self
.
project_dir
)
...
...
@@ -246,8 +275,13 @@ revision = %s
# Check if the submodule is not empty
self
.
assertTrue
(
os
.
listdir
(
submodule_repo_path
))
# Since calling buildout should've reinstalled, we expect the local changes
# to be gone
self
.
assertFalse
(
os
.
path
.
exists
(
parent_local_change_path
))
self
.
assertFalse
(
os
.
path
.
exists
(
submodule_local_change_path
))
# Get the head commit of the submodule repo
head_commit_submodule_after_first_
update
=
self
.
getRepositoryHeadCommit
(
head_commit_submodule_after_first_
revision
=
self
.
getRepositoryHeadCommit
(
submodule_repo_path
)
# Update main repo with changes of submodule
...
...
@@ -276,18 +310,18 @@ revision = %s
# Check if the submodule is not empty
self
.
assertTrue
(
os
.
listdir
(
submodule_repo_path
))
# Get the head commit of the submodule repo
head_commit_submodule_after_second_
update
=
self
.
getRepositoryHeadCommit
(
head_commit_submodule_after_second_
revision
=
self
.
getRepositoryHeadCommit
(
submodule_repo_path
)
# Check the HEAD of the submodule
submodule_head_commit
=
self
.
getRepositoryHeadCommit
(
self
.
submodule_dir
)
self
.
assertEqual
(
head_commit_submodule_after_clone
,
head_commit_submodule_after_first_
update
)
head_commit_submodule_after_first_
revision
)
self
.
assertNotEqual
(
head_commit_submodule_after_first_
update
,
head_commit_submodule_after_second_
update
)
self
.
assertNotEqual
(
head_commit_submodule_after_first_
revision
,
head_commit_submodule_after_second_
revision
)
self
.
assertEqual
(
head_commit_submodule_after_second_
update
,
self
.
assertEqual
(
head_commit_submodule_after_second_
revision
,
submodule_head_commit
)
def
test_ignore_ssl_certificate
(
self
,
ignore_ssl_certificate
=
True
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment