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
Merge requests
!507
WS-677: `null_dag` capability
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
WS-677: `null_dag` capability
WS-677-null_dag-capability
into
main
Overview
0
Commits
4
Pipelines
4
Changes
6
Merged
Nathan Hertz
requested to merge
WS-677-null_dag-capability
into
main
3 years ago
Overview
0
Commits
4
Pipelines
4
Changes
4
Expand
Additions
Added new capability:
null_dag
that simply launches the
null_dag
workflow
Added button to launch new capability to the sandbox
Changed "no-files" message to "No files are attached to this request."; added "no-parameters" message: "This request has no parameters."
Screenshot
New button
New empty-parameters/files messages
Completes
WS-677
(for real this time)
0
0
Merge request reports
Compare
version 3
version 3
60069d0e
3 years ago
version 2
b9b326f8
3 years ago
version 1
cb83f866
3 years ago
main (base)
and
latest version
latest version
b6a45c19
4 commits,
3 years ago
version 3
60069d0e
4 commits,
3 years ago
version 2
b9b326f8
4 commits,
3 years ago
version 1
cb83f866
4 commits,
3 years ago
Show latest version
4 files
+
93
−
23
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
shared/workspaces/test/test_capability_service.py
+
47
−
1
Options
"""
Unit tests for Capability Service
"""
from
unittest.mock
import
patch
# pylint: disable=C0301, E0401, R0201
import
pytest
from
workspaces.capability.schema
import
CapabilityExecution
@@ -11,7 +15,9 @@ pytest_plugins = ["testing.utils.conftest"]
@pytest.mark.usefixtures
(
"
mock_capability_service
"
)
class
TestCapabilityService
:
@pytest.mark.skip
(
"
Broken due to queue/messenger rework
"
)
"""
Tests for CapabilityService methods
"""
@pytest.mark.skip
(
"
Broken due to queue/messenger rework. Does work in local `make test`
"
)
def
test_on_ingestion_complete
(
self
,
mock_capability_service
:
CapabilityService
,
@@ -35,3 +41,43 @@ class TestCapabilityService:
assert
mock_capability_info
.
save_entity
.
call_count
==
save_entity_old_call_count
+
1
(
request
,)
=
mock_capability_info
.
save_entity
.
call_args
.
args
assert
request
.
ingested
is
True
@pytest.mark.skip
(
"
As above, broken due to queue/messenger rework? Succeeds locally; fails on CI
"
)
def
test_on_carta_ready
(
self
,
mock_capability_service
:
CapabilityService
,
mock_capability_info
:
CapabilityInfo
,
mock_capability_execution
:
CapabilityExecution
,
):
"""
Are we catching the
"
carta-ready
"
message and saving the metadata
to the capability request version?
:param mock_capability_service: stand-in for capability service
:param mock_capability_info: stand-in for capability info
:param mock_capability_execution: stand-in for capability execution
:return:
"""
wf_request_id
=
-
1
carta_url
=
"
decartes_image_carta_url
"
fake_carta_ready_msg
=
{
"
service
"
:
"
capability
"
,
"
routing_key
"
:
"
capability
"
,
"
carta_url
"
:
carta_url
,
"
subject
"
:
{
"
workflow_request_id
"
:
wf_request_id
},
"
type
"
:
"
carta-ready
"
,
}
save_entity_old_call_count
=
mock_capability_info
.
save_entity
.
call_count
with
patch
(
"
workspaces.capability.services.capability_info.CapabilityInfo.lookup_execution_by_workflow_request_id
"
,
return_value
=
mock_capability_execution
,
):
mock_capability_service
.
on_carta_ready
(
**
fake_carta_ready_msg
)
assert
mock_capability_info
.
save_entity
.
call_count
==
save_entity_old_call_count
+
1
(
request_version
,)
=
mock_capability_info
.
save_entity
.
call_args
.
args
assert
request_version
.
version_number
>
0
assert
request_version
.
workflow_metadata
[
"
carta_url
"
]
==
carta_url
Loading