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
Labels
Merge Requests
22
Merge Requests
22
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
8b1864c1
Commit
8b1864c1
authored
Oct 11, 2024
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests
parent
9ca44ddf
Pipeline
#37406
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
slapos/tests/test_slapgrid.py
slapos/tests/test_slapgrid.py
+39
-0
No files found.
slapos/tests/test_slapgrid.py
View file @
8b1864c1
...
@@ -2224,6 +2224,14 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
...
@@ -2224,6 +2224,14 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
class
TestSlapgridSoftwareRelease
(
MasterMixin
,
unittest
.
TestCase
):
class
TestSlapgridSoftwareRelease
(
MasterMixin
,
unittest
.
TestCase
):
def
setUp
(
self
):
MasterMixin
.
setUp
(
self
)
self
.
orginal_home
=
os
.
environ
[
'HOME'
]
os
.
environ
[
'HOME'
]
=
self
.
_tempdir
def
tearDown
(
self
):
os
.
environ
[
'HOME'
]
=
self
.
orginal_home
fake_waiting_time
=
0.05
fake_waiting_time
=
0.05
def
test_one_software_buildout_fail_is_correctly_logged
(
self
):
def
test_one_software_buildout_fail_is_correctly_logged
(
self
):
"""
"""
...
@@ -2291,6 +2299,37 @@ chmod a-rxw directory
...
@@ -2291,6 +2299,37 @@ chmod a-rxw directory
self
.
launchSlapgridSoftware
()
self
.
launchSlapgridSoftware
()
self
.
assertEqual
(
os
.
listdir
(
self
.
software_root
),
[])
self
.
assertEqual
(
os
.
listdir
(
self
.
software_root
),
[])
def
test_build_software_with_netrc
(
self
):
computer
=
self
.
getTestComputerClass
()(
self
.
software_root
,
self
.
instance_root
,
1
,
1
)
home
=
os
.
environ
[
'HOME'
]
netrc_file
=
os
.
path
.
join
(
home
,
'.netrc'
)
with
open
(
netrc_file
,
'w'
)
as
f
:
f
.
write
(
'machine localhost login foo password bar'
)
os
.
chmod
(
netrc_file
,
0o600
)
with
httmock
.
HTTMock
(
computer
.
request_handler
):
software
=
computer
.
software_list
[
0
]
software_path
=
os
.
path
.
join
(
self
.
software_root
,
software
.
software_hash
)
buildout_netrc
=
os
.
path
.
join
(
software_path
,
'.netrc'
)
command
=
"""#!/bin/sh
mkdir directory
touch directory/file
"""
software
.
setBuildout
(
command
)
self
.
launchSlapgridSoftware
()
self
.
assertTrue
(
os
.
path
.
exists
(
buildout_netrc
))
with
open
(
netrc_file
)
as
f
:
content
=
f
.
read
()
self
.
assertEqual
(
content
,
'machine localhost login foo password bar'
)
completed
=
os
.
path
.
join
(
software_path
,
'.completed'
)
self
.
assertTrue
(
os
.
path
.
exists
(
completed
))
os
.
remove
(
netrc_file
)
# force rerun of software
os
.
remove
(
completed
)
self
.
launchSlapgridSoftware
()
self
.
assertFalse
(
os
.
path
.
exists
(
buildout_netrc
))
class
SlapgridInitialization
(
unittest
.
TestCase
):
class
SlapgridInitialization
(
unittest
.
TestCase
):
"""
"""
...
...
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