Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
3260e695
Commit
3260e695
authored
Feb 05, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make tmp paths in TestRunner dynamic based on pid
Fixes #4723
parent
f52deaff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
28 deletions
+40
-28
test/TestRunner.py
+40
-28
No files found.
test/TestRunner.py
View file @
3260e695
...
@@ -168,50 +168,62 @@ class TestRunner(unittest.TestCase):
...
@@ -168,50 +168,62 @@ class TestRunner(unittest.TestCase):
assert
result
.
get
(
'skipped'
)
assert
result
.
get
(
'skipped'
)
def
test_git
(
self
):
def
test_git
(
self
):
self
.
_run
(
'file'
,
[
'path=/tmp/gitdemo'
,
'state=absent'
])
pid
=
os
.
getpid
()
self
.
_run
(
'file'
,
[
'path=/tmp/gd'
,
'state=absent'
])
git_demo
=
"gitdemo
%
d"
%
pid
self
.
_run
(
'file'
,
[
'path=/tmp/gdbare'
,
'state=absent'
])
git_dm
=
"gitdm
%
d"
%
pid
self
.
_run
(
'file'
,
[
'path=/tmp/gdreference'
,
'state=absent'
])
git_bare
=
"gdbare
%
d"
%
pid
self
.
_run
(
'file'
,
[
'path=/tmp/gdreftest'
,
'state=absent'
])
git_ref
=
"gdref
%
d"
%
pid
self
.
_run
(
'command'
,
[
'git init gitdemo'
,
'chdir=/tmp'
])
git_reftest
=
"gdreftest
%
d"
%
pid
self
.
_run
(
'command'
,
[
'touch a'
,
'chdir=/tmp/gitdemo'
])
self
.
_run
(
'file'
,
[
'path=/tmp/
%
s'
%
git_demo
,
'state=absent'
])
self
.
_run
(
'command'
,
[
'git add *'
,
'chdir=/tmp/gitdemo'
])
self
.
_run
(
'file'
,
[
'path=/tmp/
%
s'
%
git_dm
,
'state=absent'
])
self
.
_run
(
'command'
,
[
'git commit -m "test commit 1"'
,
'chdir=/tmp/gitdemo'
])
self
.
_run
(
'file'
,
[
'path=/tmp/
%
s'
%
git_bare
,
'state=absent'
])
self
.
_run
(
'command'
,
[
'touch b'
,
'chdir=/tmp/gitdemo'
])
self
.
_run
(
'file'
,
[
'path=/tmp/
%
s'
%
git_ref
,
'state=absent'
])
self
.
_run
(
'command'
,
[
'git add *'
,
'chdir=/tmp/gitdemo'
])
self
.
_run
(
'file'
,
[
'path=/tmp/
%
s'
%
git_reftest
,
'state=absent'
])
self
.
_run
(
'command'
,
[
'git commit -m "test commit 2"'
,
'chdir=/tmp/gitdemo'
])
self
.
_run
(
'command'
,
[
'git init
%
s'
%
git_demo
,
'chdir=/tmp'
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/gitdemo
\"
"
,
"dest=/tmp/gd"
])
self
.
_run
(
'command'
,
[
'touch a'
,
'chdir=/tmp/
%
s'
%
git_demo
])
self
.
_run
(
'command'
,
[
'git add *'
,
'chdir=/tmp/
%
s'
%
git_demo
])
self
.
_run
(
'command'
,
[
'git commit -m "test commit 1"'
,
'chdir=/tmp/
%
s'
%
git_demo
])
self
.
_run
(
'command'
,
[
'touch b'
,
'chdir=/tmp/
%
s'
%
git_demo
])
self
.
_run
(
'command'
,
[
'git add *'
,
'chdir=/tmp/
%
s'
%
git_demo
])
self
.
_run
(
'command'
,
[
'git commit -m "test commit 2"'
,
'chdir=/tmp/
%
s'
%
git_demo
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
%
s
\"
"
%
git_demo
,
"dest=/tmp/
%
s"
%
git_dm
])
assert
result
[
'changed'
]
assert
result
[
'changed'
]
# test the force option not set
# test the force option not set
self
.
_run
(
'file'
,
[
'path=/tmp/
gd/a'
,
'state=absent'
])
self
.
_run
(
'file'
,
[
'path=/tmp/
%
s/a'
%
git_dm
,
'state=absent'
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
gitdemo
\"
"
,
"dest=/tmp/gd"
,
"force=no"
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
%
s
\"
"
%
git_demo
,
"dest=/tmp/
%
s"
%
git_dm
,
"force=no"
])
assert
result
[
'failed'
]
assert
result
[
'failed'
]
# test the force option when set
# test the force option when set
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
gitdemo
\"
"
,
"dest=/tmp/gd"
,
"force=yes"
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
%
s
\"
"
%
git_demo
,
"dest=/tmp/
%
s"
%
git_dm
,
"force=yes"
])
assert
result
[
'changed'
]
assert
result
[
'changed'
]
# test the bare option
# test the bare option
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
gitdemo
\"
"
,
"dest=/tmp/gdbare"
,
"bare=yes"
,
"remote=test"
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
%
s
\"
"
%
git_demo
,
"dest=/tmp/
%
s"
%
git_bare
,
"bare=yes"
,
"remote=test"
])
assert
result
[
'changed'
]
assert
result
[
'changed'
]
# test a no-op fetch, add origin for el6 versions of git
# test a no-op fetch, add origin for el6 versions of git
self
.
_run
(
'command'
,
[
'git remote add origin file:///tmp/
gitdemo'
,
'chdir=/tmp/gdbare'
])
self
.
_run
(
'command'
,
[
'git remote add origin file:///tmp/
%
s'
%
git_demo
,
'chdir=/tmp/
%
s'
%
git_dm
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
gitdemo
\"
"
,
"dest=/tmp/gdbare"
,
"bare=yes"
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
%
s
\"
"
%
git_demo
,
"dest=/tmp/
%
s"
%
git_bare
,
"bare=yes"
])
assert
not
result
[
'changed'
]
assert
not
result
[
'changed'
]
# test whether fetch is working for bare repos
# test whether fetch is working for bare repos
self
.
_run
(
'command'
,
[
'touch c'
,
'chdir=/tmp/
gitdemo'
])
self
.
_run
(
'command'
,
[
'touch c'
,
'chdir=/tmp/
%
s'
%
git_demo
])
self
.
_run
(
'command'
,
[
'git add *'
,
'chdir=/tmp/
gitdemo'
])
self
.
_run
(
'command'
,
[
'git add *'
,
'chdir=/tmp/
%
s'
%
git_demo
])
self
.
_run
(
'command'
,
[
'git commit -m "test commit 3"'
,
'chdir=/tmp/
gitdemo'
])
self
.
_run
(
'command'
,
[
'git commit -m "test commit 3"'
,
'chdir=/tmp/
%
s'
%
git_demo
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
gitdemo
\"
"
,
"dest=/tmp/gdbare"
,
"bare=yes"
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
%
s
\"
"
%
git_demo
,
"dest=/tmp/
%
s"
%
git_bare
,
"bare=yes"
])
assert
result
[
'changed'
]
assert
result
[
'changed'
]
# test reference repos
# test reference repos
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
gdbare
\"
"
,
"dest=/tmp/gdreference"
,
"bare=yes"
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
%
s
\"
"
%
git_bare
,
"dest=/tmp/
%
s"
%
git_ref
,
"bare=yes"
])
assert
result
[
'changed'
]
assert
result
[
'changed'
]
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
gitdemo
\"
"
,
"dest=/tmp/gdreftest"
,
"reference=/tmp/gdreference/"
])
result
=
self
.
_run
(
'git'
,
[
"repo=
\"
file:///tmp/
%
s
\"
"
%
git_demo
,
"dest=/tmp/
%
s"
%
git_reftest
,
"reference=/tmp/
%
s/"
%
git_ref
])
assert
result
[
'changed'
]
assert
result
[
'changed'
]
assert
os
.
path
.
isfile
(
'/tmp/
gdreftest/a'
)
assert
os
.
path
.
isfile
(
'/tmp/
%
s/a'
%
git_reftest
)
result
=
self
.
_run
(
'command'
,
[
'ls'
,
'chdir=/tmp/
gdreference/objects/pack'
])
result
=
self
.
_run
(
'command'
,
[
'ls'
,
'chdir=/tmp/
%
s/objects/pack'
%
git_ref
])
assert
result
[
'stdout'
]
!=
''
assert
result
[
'stdout'
]
!=
''
result
=
self
.
_run
(
'command'
,
[
'ls'
,
'chdir=/tmp/
gdreftest/.git/objects/pack'
])
result
=
self
.
_run
(
'command'
,
[
'ls'
,
'chdir=/tmp/
%
s/.git/objects/pack'
%
git_reftest
])
assert
result
[
'stdout'
]
==
''
assert
result
[
'stdout'
]
==
''
# cleanup
self
.
_run
(
'file'
,
[
'path=/tmp/
%
s'
%
git_demo
,
'state=absent'
])
self
.
_run
(
'file'
,
[
'path=/tmp/
%
s'
%
git_dm
,
'state=absent'
])
self
.
_run
(
'file'
,
[
'path=/tmp/
%
s'
%
git_bare
,
'state=absent'
])
self
.
_run
(
'file'
,
[
'path=/tmp/
%
s'
%
git_ref
,
'state=absent'
])
self
.
_run
(
'file'
,
[
'path=/tmp/
%
s'
%
git_reftest
,
'state=absent'
])
def
test_file
(
self
):
def
test_file
(
self
):
filedemo
=
tempfile
.
mkstemp
()[
1
]
filedemo
=
tempfile
.
mkstemp
()[
1
]
...
...
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