Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
103
Merge Requests
103
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
4eed4734
Commit
4eed4734
authored
Nov 03, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
theia/test/project_tests: update gitlab tests for gitlab 13
parent
aa4b9bf6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
software/theia/test/project_tests.py
software/theia/test/project_tests.py
+13
-11
No files found.
software/theia/test/project_tests.py
View file @
4eed4734
...
@@ -499,7 +499,7 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
...
@@ -499,7 +499,7 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
# Create a new project
# Create a new project
print
(
"Gitlab create a project"
)
print
(
"Gitlab create a project"
)
path
=
'/api/v
3
/projects'
path
=
'/api/v
4
/projects'
parameter_dict
=
{
'name'
:
'sample-test'
,
'namespace'
:
'open'
}
parameter_dict
=
{
'name'
:
'sample-test'
,
'namespace'
:
'open'
}
# Token can be set manually
# Token can be set manually
headers
=
{
"PRIVATE-TOKEN"
:
'SLurtnxPscPsU-SDm4oN'
}
headers
=
{
"PRIVATE-TOKEN"
:
'SLurtnxPscPsU-SDm4oN'
}
...
@@ -508,14 +508,14 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
...
@@ -508,14 +508,14 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
# Check the project is exist
# Check the project is exist
print
(
"Gitlab check project is exist"
)
print
(
"Gitlab check project is exist"
)
path
=
'/api/v
3
/projects'
path
=
'/api/v
4
/projects'
response
=
requests
.
get
(
backend_url
+
path
,
headers
=
headers
,
verify
=
False
)
response
=
requests
.
get
(
backend_url
+
path
,
params
=
{
'search'
:
'sample-test'
},
headers
=
headers
,
verify
=
False
)
try
:
try
:
projects
=
response
.
json
()
projects
=
response
.
json
()
except
JSONDecodeError
:
except
JSONDecodeError
:
self
.
fail
(
"No json file returned! Maybe your Gitlab URL is incorrect."
)
self
.
fail
(
"No json file returned! Maybe your Gitlab URL is incorrect."
)
# Only one project
exist
# Only one project
matches the search
self
.
assertEqual
(
len
(
projects
),
1
)
self
.
assertEqual
(
len
(
projects
),
1
)
# The project name is sample-test, which we created above.
# The project name is sample-test, which we created above.
self
.
assertIn
(
"sample-test"
,
projects
[
0
][
'name_with_namespace'
])
self
.
assertIn
(
"sample-test"
,
projects
[
0
][
'name_with_namespace'
])
...
@@ -543,12 +543,14 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
...
@@ -543,12 +543,14 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
output
=
subprocess
.
check_output
((
'git'
,
'push'
,
'origin'
),
cwd
=
repo_path
,
universal_newlines
=
True
)
output
=
subprocess
.
check_output
((
'git'
,
'push'
,
'origin'
),
cwd
=
repo_path
,
universal_newlines
=
True
)
# Do a fake periodically update
# Do a fake periodically update
# Compute backup date in the near future
# Compute backup date in the future
soon
=
(
datetime
.
now
()
+
timedelta
(
minutes
=
4
))
# During slapos node instance, the static assets are recompiled, which takes a lot
# of time, so we give it at least 20 minutes.
soon
=
(
datetime
.
now
()
+
timedelta
(
minutes
=
20
))
frequency
=
"%d * * * *"
%
soon
.
minute
frequency
=
"%d * * * *"
%
soon
.
minute
params
=
'backup_frequency=%s'
%
frequency
params
=
'backup_frequency=%s'
%
frequency
# Update
Peertube
parameters
# Update
Gitlab
parameters
print
(
'Requesting Gitlab with parameters %s'
%
params
)
print
(
'Requesting Gitlab with parameters %s'
%
params
)
self
.
checkSlapos
(
'request'
,
'test_instance'
,
self
.
_test_software_url
,
'--parameters'
,
params
)
self
.
checkSlapos
(
'request'
,
'test_instance'
,
self
.
_test_software_url
,
'--parameters'
,
params
)
...
@@ -557,8 +559,8 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
...
@@ -557,8 +559,8 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
self
.
callSlapos
(
'node'
,
'restart'
,
'all'
)
self
.
callSlapos
(
'node'
,
'restart'
,
'all'
)
# Wait until after the programmed backup date, and a bit more
# Wait until after the programmed backup date, and a bit more
t
=
(
soon
-
datetime
.
now
(
)).
total_seconds
()
t
=
(
(
soon
-
datetime
.
now
())
+
timedelta
(
minutes
=
10
)).
total_seconds
()
time
.
sleep
(
t
+
240
)
time
.
sleep
(
t
)
self
.
callSlapos
(
'node'
,
'status'
)
self
.
callSlapos
(
'node'
,
'status'
)
os
.
chdir
(
self
.
temp_clone_dir
)
os
.
chdir
(
self
.
temp_clone_dir
)
...
@@ -583,9 +585,9 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
...
@@ -583,9 +585,9 @@ class TestTheiaResilienceGitlab(test_resiliency.TestTheiaResilience):
# Check the project is exist
# Check the project is exist
print
(
"Gitlab check project is exist"
)
print
(
"Gitlab check project is exist"
)
path
=
'/api/v
3
/projects'
path
=
'/api/v
4
/projects'
headers
=
{
"PRIVATE-TOKEN"
:
'SLurtnxPscPsU-SDm4oN'
}
headers
=
{
"PRIVATE-TOKEN"
:
'SLurtnxPscPsU-SDm4oN'
}
response
=
requests
.
get
(
backend_url
+
path
,
headers
=
headers
,
verify
=
False
)
response
=
requests
.
get
(
backend_url
+
path
,
params
=
{
'search'
:
'sample-test'
},
headers
=
headers
,
verify
=
False
)
try
:
try
:
projects
=
response
.
json
()
projects
=
response
.
json
()
except
JSONDecodeError
:
except
JSONDecodeError
:
...
...
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