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
236adcce
Commit
236adcce
authored
3 years ago
by
Janet Goldstein
Browse files
Options
Downloads
Patches
Plain Diff
Gripe: fix broken solicitor tests
parent
97d52d0b
No related branches found
No related tags found
1 merge request
!829
Gripe: fix broken solicitor tests
Pipeline
#4532
passed
3 years ago
Stage: cache-build
Stage: build
Stage: unit-test
Stage: test-coverage
Stage: push
Stage: deploy-coverage-page
Stage: generate-yaml
Stage: trigger
Stage: deploy
Stage: e2e-test
Stage: .post
Pipeline: workspaces
#4533
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/cli/executables/pexable/ingest_envoy/test/test_solicitor.py
+61
-16
61 additions, 16 deletions
...i/executables/pexable/ingest_envoy/test/test_solicitor.py
with
61 additions
and
16 deletions
apps/cli/executables/pexable/ingest_envoy/test/test_solicitor.py
+
61
−
16
View file @
236adcce
...
@@ -18,12 +18,22 @@
...
@@ -18,12 +18,22 @@
"""
"""
Tests for solicitor.py
Tests for solicitor.py
"""
"""
from
ingest_envoy.solicitor
import
Solicitor
# pylint: disable=E0401, C0301, C0116, R0201, W0621
from
unittest.mock
import
patch
import
pytest
import
pytest
from
ingest_envoy.solicitor
import
Solicitor
SOLICIT_WORKFLOWS_PATCH
=
"
ingest_envoy.solicitor.Solicitor.solicit_contents
"
@pytest.fixture
(
scope
=
"
function
"
)
def
solicitor
()
->
Solicitor
:
with
patch
(
SOLICIT_WORKFLOWS_PATCH
)
as
mock_content
:
mock_content
.
return_value
=
expected_metadata
return
Solicitor
(
""
,
"
calibration
"
,
[
"
http://capability:3457
"
,
"
http://workflow:3456
"
])
solicitor
=
Solicitor
(
"
test/input_files/test-metadata.json
"
,
"
calibration
"
,
[
"
http://capability:3457
"
,
"
http://workflow:3456
"
]
)
expected_metadata
=
{
expected_metadata
=
{
"
fileSetIds
"
:
"
16B-069_sb32814386_1_001.57685.66193635417
"
,
"
fileSetIds
"
:
"
16B-069_sb32814386_1_001.57685.66193635417
"
,
"
workflowName
"
:
"
std_calibration
"
,
"
workflowName
"
:
"
std_calibration
"
,
...
@@ -35,7 +45,7 @@ expected_metadata = {
...
@@ -35,7 +45,7 @@ expected_metadata = {
"
title
"
:
"
JVLA monitoring of an in-progress extreme scattering event
"
,
"
title
"
:
"
JVLA monitoring of an in-progress extreme scattering event
"
,
"
telescope
"
:
"
EVLA
"
,
"
telescope
"
:
"
EVLA
"
,
"
startTime
"
:
"
57685.661952546296
"
,
"
startTime
"
:
"
57685.661952546296
"
,
"
observer
"
:
"
Keith Bannister
"
,
"
observer
"
:
"
Mickey Mouse
"
,
},
},
"
destinationDirectory
"
:
"
/lustre/aoc/cluster/pipeline/docker/workspaces/spool/tmp576dknjp
"
,
"
destinationDirectory
"
:
"
/lustre/aoc/cluster/pipeline/docker/workspaces/spool/tmp576dknjp
"
,
}
}
...
@@ -43,23 +53,23 @@ expected_metadata = {
...
@@ -43,23 +53,23 @@ expected_metadata = {
class
TestSolicitor
:
class
TestSolicitor
:
def
test_solicit_contents
(
self
):
def
test_solicit_contents
(
self
):
metadata
=
solicitor
.
solicit_contents
()
with
patch
(
SOLICIT_WORKFLOWS_PATCH
)
as
mock_content
:
assert
metadata
==
expected_metadata
mock_content
.
return_value
=
expected_metadata
solicitor
=
Solicitor
(
""
,
"
calibration
"
,
[
"
http://capability:3457
"
,
"
http://workflow:3456
"
])
mock_content
.
assert_called
()
assert
solicitor
.
metadata
==
expected_metadata
def
test_solicit_workflow_directory_name
(
self
):
def
test_solicit_workflow_directory_name
(
self
,
solicitor
:
Solicitor
):
expected_workflow_dir_name
=
"
tmp576dknjp
"
expected_workflow_dir_name
=
"
tmp576dknjp
"
name
=
solicitor
.
solicit_workflow_directory_name
()
name
=
solicitor
.
solicit_workflow_directory_name
()
assert
name
==
expected_workflow_dir_name
assert
name
==
expected_workflow_dir_name
def
test_solicit_processing_creation_time
(
self
):
def
test_solicit_processing_creation_time
(
self
,
solicitor
:
Solicitor
):
expected_corrected_time
=
"
2021_07_06T21_50_48
"
expected_corrected_time
=
"
2021_07_06T21_50_48
"
time_string
=
solicitor
.
solicit_processing_creation_time
()
time_string
=
solicitor
.
solicit_processing_creation_time
()
assert
time_string
==
expected_corrected_time
assert
time_string
==
expected_corrected_time
@pytest.mark.skip
(
"
Broken by multiversion changes
"
)
def
test_solicit_parameters_std_cal
(
self
,
solicitor
:
Solicitor
):
def
test_solicit_parameters
(
self
):
expected_parameters
=
{
expected_parameters
=
{
"
sdmId
"
:
"
16B-069_sb32814386_1_001.57685.66193635417
"
,
"
sdmId
"
:
"
16B-069_sb32814386_1_001.57685.66193635417
"
,
"
telescope
"
:
"
EVLA
"
,
"
telescope
"
:
"
EVLA
"
,
...
@@ -67,9 +77,44 @@ class TestSolicitor:
...
@@ -67,9 +77,44 @@ class TestSolicitor:
"
workflowRequestId
"
:
"
2
"
,
"
workflowRequestId
"
:
"
2
"
,
"
spl
"
:
"
uid://evla/execblock/48ba4c9d-d7c7-4a8f-9803-1115cd52459b
"
,
"
spl
"
:
"
uid://evla/execblock/48ba4c9d-d7c7-4a8f-9803-1115cd52459b
"
,
"
processingStart
"
:
"
2021_07_06T21_50_48
"
,
"
processingStart
"
:
"
2021_07_06T21_50_48
"
,
"
destinationDir
"
:
"
/
lustre/aoc/cluster/pipeline/docker/workspaces/spool
/tmp576dknjp
"
,
"
destinationDir
"
:
"
/
somewhere/over/the/rainbow
/tmp576dknjp
"
,
"
workflowDir
"
:
"
tmp576dknjp
"
,
"
workflowDir
"
:
"
tmp576dknjp
"
,
"
initialVersionDir
"
:
"
tmp24i4o1yl
"
,
"
multiVersion
"
:
True
,
}
}
with
patch
(
SOLICIT_WORKFLOWS_PATCH
):
with
patch
(
"
ingest_envoy.solicitor.Solicitor.solicit_initial_directory_name
"
,
return_value
=
"
tmp24i4o1yl
"
):
parameters
=
solicitor
.
solicit_parameters
()
assert
parameters
[
"
workflowDir
"
]
==
expected_parameters
[
"
workflowDir
"
]
assert
parameters
[
"
initialVersionDir
"
]
==
expected_parameters
[
"
initialVersionDir
"
]
parameters
=
solicitor
.
solicit_parameters
()
def
test_solicit_parameters_image
(
self
,
solicitor
:
Solicitor
):
assert
parameters
==
expected_parameters
initial_version_dir
=
"
initial_version_dir
"
cal_source_dir
=
"
tmp576dknjp
"
metadata
=
{
"
fileSetIds
"
:
"
brain_000.58099.67095825232
"
,
"
workflowName
"
:
"
std_cms_imaging
"
,
"
systemId
"
:
"
12
"
,
"
creationTime
"
:
"
2021-07-29T14:26:31
"
,
"
productLocator
"
:
"
uid://evla/execblock/ec082e65-452d-4fec-ad88-f5b4af1f9e36
"
,
"
calProductLocator
"
:
"
uid://eenie/meanie/miney/moe
"
,
"
projectMetadata
"
:
{
"
projectCode
"
:
"
Operations
"
,
"
title
"
:
""
,
"
telescope
"
:
"
EVLA
"
,
"
startTime
"
:
"
58099.6710792824
"
,
"
observer
"
:
"
Just Us Chickens
"
,
},
"
destinationDirectory
"
:
"
/lustre/aoc/cluster/pipeline/docker/workspaces/spool/
"
+
initial_version_dir
,
"
calibrationSourceDirectory
"
:
f
"
/my/stuff/
{
cal_source_dir
}
/working
"
,
"
cmsName
"
:
"
brain_000.58099.67095825232.ms
"
,
}
with
patch
(
SOLICIT_WORKFLOWS_PATCH
,
return_value
=
metadata
):
with
patch
(
"
ingest_envoy.solicitor.Solicitor.solicit_initial_directory_name
"
,
return_value
=
initial_version_dir
):
solicitor
.
argument
=
"
image
"
parameters
=
solicitor
.
solicit_parameters
()
assert
parameters
[
"
workflowDir
"
]
==
cal_source_dir
assert
parameters
[
"
calSpl
"
]
==
metadata
[
"
calProductLocator
"
]
assert
parameters
[
"
multiVersion
"
]
is
True
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