Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.libnetworkcache
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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Ophélie Gagnard
slapos.libnetworkcache
Commits
ac108329
Commit
ac108329
authored
Aug 23, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to test against real server.
parent
18a26c12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
slapos/libnetworkcachetests.py
slapos/libnetworkcachetests.py
+12
-10
No files found.
slapos/libnetworkcachetests.py
View file @
ac108329
...
@@ -160,13 +160,14 @@ class OnlineMixin:
...
@@ -160,13 +160,14 @@ class OnlineMixin:
def
setUp
(
self
):
def
setUp
(
self
):
self
.
host
=
"127.0.0.1"
self
.
host
=
"127.0.0.1"
self
.
port
=
8080
self
.
port
=
8080
self
.
tree
=
tempfile
.
mkdtemp
()
self
.
_start_nc
()
self
.
url
=
'http://%s:%s/'
%
(
self
.
host
,
self
.
port
)
self
.
url
=
'http://%s:%s/'
%
(
self
.
host
,
self
.
port
)
self
.
shacache
=
os
.
environ
.
get
(
'TEST_SHA_CACHE'
,
self
.
shacache
=
os
.
environ
.
get
(
'TEST_SHA_CACHE'
,
self
.
url
+
'shacache'
)
self
.
url
+
'shacache'
)
self
.
shadir
=
os
.
environ
.
get
(
'TEST_SHA_DIR'
,
self
.
shadir
=
os
.
environ
.
get
(
'TEST_SHA_DIR'
,
self
.
url
+
'shadir'
)
self
.
url
+
'shadir'
)
if
not
'TEST_SHA_CACHE'
in
os
.
environ
and
not
'TEST_SHA_DIR'
in
os
.
environ
:
self
.
tree
=
tempfile
.
mkdtemp
()
self
.
_start_nc
()
self
.
test_data
=
tempfile
.
TemporaryFile
()
self
.
test_data
=
tempfile
.
TemporaryFile
()
self
.
test_string
=
str
(
random
.
random
())
self
.
test_string
=
str
(
random
.
random
())
self
.
test_data
.
write
(
self
.
test_string
)
self
.
test_data
.
write
(
self
.
test_string
)
...
@@ -175,14 +176,15 @@ class OnlineMixin:
...
@@ -175,14 +176,15 @@ class OnlineMixin:
self
.
test_data
.
seek
(
0
)
self
.
test_data
.
seek
(
0
)
def
tearDown
(
self
):
def
tearDown
(
self
):
try
:
if
not
'TEST_SHA_CACHE'
in
os
.
environ
and
not
'TEST_SHA_DIR'
in
os
.
environ
:
httplib
.
HTTPConnection
(
self
.
host
,
self
.
port
).
request
(
'KILL'
,
'/'
)
try
:
except
Exception
:
httplib
.
HTTPConnection
(
self
.
host
,
self
.
port
).
request
(
'KILL'
,
'/'
)
pass
except
Exception
:
pass
if
self
.
thread
is
not
None
:
self
.
thread
.
join
()
if
self
.
thread
is
not
None
:
shutil
.
rmtree
(
self
.
tree
)
self
.
thread
.
join
()
shutil
.
rmtree
(
self
.
tree
)
class
OnlineTest
(
OnlineMixin
,
unittest
.
TestCase
):
class
OnlineTest
(
OnlineMixin
,
unittest
.
TestCase
):
"""Online tests against real HTTP server"""
"""Online tests against real HTTP server"""
...
...
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