Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Commits
2f03734e
Commit
2f03734e
authored
1 year ago
by
Brittany Faciane
Browse files
Options
Downloads
Patches
Plain Diff
Remove tests that rely on docker
parent
9bbd2bd4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1452
Merge 2.8.2 to main
,
!1382
Remove tests that rely on docker
Pipeline
#10025
passed
1 year ago
Stage: pull-db
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/cli/executables/pexable/wf_inspector/test/test_inspector.py
+1
-55
1 addition, 55 deletions
...i/executables/pexable/wf_inspector/test/test_inspector.py
with
1 addition
and
55 deletions
apps/cli/executables/pexable/wf_inspector/test/test_inspector.py
+
1
−
55
View file @
2f03734e
...
...
@@ -50,61 +50,7 @@ TEST_BATCH_ID = 4
TEST_DAG_JOB_ID
=
5
def
test_get_container_id_by_substr_found
():
fake_completed_process
=
CompletedProcess
(
[
"
docker
"
,
"
ps
"
,
"
-q
"
,
"
-f
"
,
"
workflow
"
],
returncode
=
0
,
stdout
=
TEST_CONTAINER_ID
)
with
patch
(
"
wf_inspector.inspector.subprocess.run
"
,
return_value
=
fake_completed_process
):
test_container_id
=
get_container_id_by_substr
(
"
workflow
"
)
assert
test_container_id
==
TEST_CONTAINER_ID
def
test_get_container_id_by_substr_not_found
():
fake_completed_process
=
CompletedProcess
([
"
docker
"
,
"
ps
"
,
"
-q
"
,
"
-f
"
,
"
workflow
"
],
returncode
=
0
,
stdout
=
""
)
with
patch
(
"
wf_inspector.inspector.subprocess.run
"
,
return_value
=
fake_completed_process
):
test_container_id
=
get_container_id_by_substr
(
"
workflow
"
)
assert
test_container_id
is
None
def
test_get_container_id_by_substr_error
(
caplog
):
expected_logs
=
[
"
Docker command not accessible. Docker is either not installed or you lack permissions to use it.
"
,
"
Are you running this from within a Docker container? Docker is not installed in containers.
"
,
]
fake_completed_process
=
CompletedProcess
([
"
docker
"
,
"
ps
"
,
"
-q
"
,
"
-f
"
,
"
workflow
"
],
returncode
=
1
,
stdout
=
""
)
with
patch
(
"
wf_inspector.inspector.subprocess.run
"
,
return_value
=
fake_completed_process
):
test_container_id
=
get_container_id_by_substr
(
"
workflow
"
)
assert
test_container_id
is
None
# Assert all expected logs have been logged out
assert
all
(
log
in
[
record
.
message
for
record
in
caplog
.
records
]
for
log
in
expected_logs
)
def
test_get_wf_request_htcondor_id_docker
():
# Environment save point
capo_profile_savepoint
=
os
.
environ
.
get
(
"
CAPO_PROFILE
"
)
# Set environment to check that the URL is set correctly
os
.
environ
[
"
CAPO_PROFILE
"
]
=
"
docker
"
fake_response
=
MagicMock
()
fake_response
.
status_code
=
200
fake_response
.
json
.
return_value
=
{
"
htcondor_job_id
"
:
"
-1
"
}
with
patch
(
"
wf_inspector.inspector.requests.get
"
,
return_value
=
fake_response
)
as
mock_get
:
test_htcondor_id
=
get_wf_request_htcondor_id
(
"
-1
"
)
mock_get
.
assert_called_with
(
"
http://localhost:3456/workflows/name/requests/-1/htcondor_id
"
)
assert
test_htcondor_id
==
-
1
# Return environment to previous state
if
capo_profile_savepoint
is
None
:
capo_profile_savepoint
=
""
os
.
environ
[
"
CAPO_PROFILE
"
]
=
capo_profile_savepoint
def
test_get_wf_request_htcondor_id_nondocker
():
def
test_get_wf_request_htcondor_id
():
# Environment save point
capo_profile_savepoint
=
os
.
environ
.
get
(
"
CAPO_PROFILE
"
)
# Set environment to check that the URL is set correctly
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment