Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric Zheng
slapos.core
Commits
ea469626
Commit
ea469626
authored
Sep 27, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cache blacklist basic tests
parent
a62eb7eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
128 additions
and
2 deletions
+128
-2
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+128
-2
No files found.
slapos/tests/slapgrid.py
View file @
ea469626
...
...
@@ -965,9 +965,10 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
[
instance
.
software
.
software_hash
])
self
.
assertEqual
(
computer
.
sequence
,
[
'getFullComputerInformation'
])
class
TestSlapgridArgumentTuple
(
unittest
.
TestCase
):
class
SlapgridInitialization
(
unittest
.
TestCase
):
"""
"Abstract" class setting setup and teardown for TestSlapgridArgumentTuple
and TestSlapgridConfigurationFile.
"""
def
setUp
(
self
):
...
...
@@ -1005,6 +1006,11 @@ buildout = /path/to/buildout/binary
self
.
signature_key_file_descriptor
.
close
()
shutil
.
rmtree
(
self
.
certificate_repository_path
,
True
)
class
TestSlapgridArgumentTuple
(
SlapgridInitialization
):
"""
Test suite about arguments given to slapgrid command.
"""
def
test_empty_argument_tuple
(
self
):
"""
Raises if the argument list if empty and without configuration file.
...
...
@@ -1085,6 +1091,126 @@ buildout = /path/to/buildout/binary
slapgrid_object
=
parser
(
*
argument_tuple
)[
0
]
self
.
assertTrue
(
slapgrid_object
.
force_periodicity
)
class
TestSlapgridConfigurationFile
(
SlapgridInitialization
):
def
test_upload_binary_cache_blacklist
(
self
):
"""
Check if giving --upload-to-binary-cache-url-blacklist triggers option.
"""
self
.
slapos_config_descriptor
.
write
(
"""
[slapos]
software_root = /opt/slapgrid
instance_root = /srv/slapgrid
master_url = https://slap.vifib.com/
computer_id = your computer id
buildout = /path/to/buildout/binary
[networkcache]
upload-to-binary-cache-url-blacklist =
http://1
http://2/bla
"""
%
dict
(
fake_file
=
self
.
fake_file_descriptor
.
name
))
self
.
slapos_config_descriptor
.
seek
(
0
)
slapgrid_object
=
slapgrid
.
parseArgumentTupleAndReturnSlapgridObject
(
*
self
.
default_arg_tuple
)[
0
]
self
.
assertEqual
(
slapgrid_object
.
upload_to_binary_cache_url_blacklist
,
[
'http://1'
,
'http://2/bla'
]
)
self
.
assertEqual
(
slapgrid_object
.
download_from_binary_cache_url_blacklist
,
[]
)
def
test_download_binary_cache_blacklist
(
self
):
"""
Check if giving --download-from-binary-cache-url-blacklist triggers option.
"""
self
.
slapos_config_descriptor
.
write
(
"""
[slapos]
software_root = /opt/slapgrid
instance_root = /srv/slapgrid
master_url = https://slap.vifib.com/
computer_id = your computer id
buildout = /path/to/buildout/binary
[networkcache]
download-from-binary-cache-url-blacklist =
http://1
http://2/bla
"""
%
dict
(
fake_file
=
self
.
fake_file_descriptor
.
name
))
self
.
slapos_config_descriptor
.
seek
(
0
)
slapgrid_object
=
slapgrid
.
parseArgumentTupleAndReturnSlapgridObject
(
*
self
.
default_arg_tuple
)[
0
]
self
.
assertEqual
(
slapgrid_object
.
upload_to_binary_cache_url_blacklist
,
[]
)
self
.
assertEqual
(
slapgrid_object
.
download_from_binary_cache_url_blacklist
,
[
'http://1'
,
'http://2/bla'
]
)
def
test_upload_download_binary_cache_blacklist
(
self
):
"""
Check if giving both --download-from-binary-cache-url-blacklist
and --upload-to-binary-cache-url-blacklist triggers options.
"""
self
.
slapos_config_descriptor
.
write
(
"""
[slapos]
software_root = /opt/slapgrid
instance_root = /srv/slapgrid
master_url = https://slap.vifib.com/
computer_id = your computer id
buildout = /path/to/buildout/binary
[networkcache]
upload-to-binary-cache-url-blacklist =
http://1
http://2/bla
download-from-binary-cache-url-blacklist =
http://3
http://4/bla
"""
%
dict
(
fake_file
=
self
.
fake_file_descriptor
.
name
))
self
.
slapos_config_descriptor
.
seek
(
0
)
slapgrid_object
=
slapgrid
.
parseArgumentTupleAndReturnSlapgridObject
(
*
self
.
default_arg_tuple
)[
0
]
self
.
assertEqual
(
slapgrid_object
.
upload_to_binary_cache_url_blacklist
,
[
'http://1'
,
'http://2/bla'
]
)
self
.
assertEqual
(
slapgrid_object
.
download_from_binary_cache_url_blacklist
,
[
'http://3'
,
'http://4/bla'
]
)
def
test_backward_compatibility_download_binary_cache_blacklist
(
self
):
"""
Check if giving both --binary-cache-url-blacklist
and --upload-to-binary-cache-blacklist triggers options.
"""
self
.
slapos_config_descriptor
.
write
(
"""
[slapos]
software_root = /opt/slapgrid
instance_root = /srv/slapgrid
master_url = https://slap.vifib.com/
computer_id = your computer id
buildout = /path/to/buildout/binary
[networkcache]
binary-cache-url-blacklist =
http://1
http://2/bla
"""
%
dict
(
fake_file
=
self
.
fake_file_descriptor
.
name
))
self
.
slapos_config_descriptor
.
seek
(
0
)
slapgrid_object
=
slapgrid
.
parseArgumentTupleAndReturnSlapgridObject
(
*
self
.
default_arg_tuple
)[
0
]
self
.
assertEqual
(
slapgrid_object
.
upload_to_binary_cache_url_blacklist
,
[]
)
self
.
assertEqual
(
slapgrid_object
.
download_from_binary_cache_url_blacklist
,
[
'http://1'
,
'http://2/bla'
]
)
class
TestSlapgridCPWithMasterPromise
(
MasterMixin
,
unittest
.
TestCase
):
def
test_one_failing_promise
(
self
):
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
)
...
...
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