Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
atdb-ldv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASTRON SDC
atdb-ldv
Commits
97b5e263
Commit
97b5e263
authored
1 year ago
by
Nico Vermaas
Browse files
Options
Downloads
Patches
Plain Diff
add unit tests
parent
952a88af
No related branches found
No related tags found
1 merge request
!350
SDC-1313 ancillary dataproducts to dcache (ATDB side)
Pipeline
#78889
passed
1 year ago
Stage: test
Stage: build
Stage: deploy_to_test
Stage: deploy_to_production
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
atdb/taskdatabase/tests/test_summary_tasks.py
+54
-13
54 additions, 13 deletions
atdb/taskdatabase/tests/test_summary_tasks.py
with
54 additions
and
13 deletions
atdb/taskdatabase/tests/test_summary_tasks.py
+
54
−
13
View file @
97b5e263
...
@@ -10,33 +10,74 @@ class TestSummaryTasks(TestCase):
...
@@ -10,33 +10,74 @@ class TestSummaryTasks(TestCase):
self
.
workflow_requantisation
=
Workflow
(
id
=
22
,
workflow_uri
=
"
psrfits_requantisation
"
)
self
.
workflow_requantisation
=
Workflow
(
id
=
22
,
workflow_uri
=
"
psrfits_requantisation
"
)
self
.
workflow_requantisation
.
save
()
self
.
workflow_requantisation
.
save
()
self
.
no_summary_task
=
Task
.
objects
.
create
(
sas_id
=
77777
,
new_status
=
State
.
DEFINED
.
value
,
workflow
=
self
.
workflow_requantisation
,
self
.
no_summary_task
_77777
=
Task
.
objects
.
create
(
sas_id
=
77777
,
new_status
=
State
.
DEFINED
.
value
,
workflow
=
self
.
workflow_requantisation
,
outputs
=
{
"
tar_archive
"
:
[{
"
size
"
:
4885985280
,
"
basename
"
:
"
L621240_SAP002_B073_P000_bf.tar
"
,
"
nameroot
"
:
"
L621240_SAP002_B073_P000_bf
"
}]})
outputs
=
{
"
tar_archive
"
:
[{
"
size
"
:
4885985280
,
"
basename
"
:
"
L621240_SAP002_B073_P000_bf.tar
"
,
"
nameroot
"
:
"
L621240_SAP002_B073_P000_bf
"
}]})
self
.
summary_task_defined
=
Task
.
objects
.
create
(
sas_id
=
77777
,
new_status
=
State
.
DEFINED
.
value
,
workflow
=
self
.
workflow_requantisation
,
self
.
summary_task_defined
_77777
=
Task
.
objects
.
create
(
sas_id
=
77777
,
new_status
=
State
.
DEFINED
.
value
,
workflow
=
self
.
workflow_requantisation
,
outputs
=
{
"
tar_archive
"
:
[{
"
size
"
:
4885985280
,
"
basename
"
:
"
L185619_summaryCS.tar
"
,
"
nameroot
"
:
"
L185619_summaryCS
"
}]})
outputs
=
{
"
tar_archive
"
:
[{
"
size
"
:
4885985280
,
"
basename
"
:
"
L185619_summaryCS.tar
"
,
"
nameroot
"
:
"
L185619_summaryCS
"
}]})
self
.
summary_task_validated
=
Task
.
objects
.
create
(
sas_id
=
77777
,
new_status
=
State
.
VALIDATED
.
value
,
workflow
=
self
.
workflow_requantisation
,
self
.
summary_task_validated_77777
=
Task
.
objects
.
create
(
sas_id
=
77777
,
new_status
=
State
.
VALIDATED
.
value
,
workflow
=
self
.
workflow_requantisation
,
outputs
=
{
"
tar_archive
"
:
[{
"
size
"
:
4885985280
,
"
basename
"
:
"
L185619_summaryCS.tar
"
,
"
nameroot
"
:
"
L185619_summaryCS
"
}]})
self
.
summary_task_processed_77777
=
Task
.
objects
.
create
(
sas_id
=
77777
,
new_status
=
State
.
PROCESSED
.
value
,
workflow
=
self
.
workflow_requantisation
,
outputs
=
{
"
tar_archive
"
:
[{
"
size
"
:
4885985280
,
"
basename
"
:
"
L185619_summaryCS.tar
"
,
"
nameroot
"
:
"
L185619_summaryCS
"
}]})
# simulate an Activity that is processed, with 1 task already in STORED, the other one in PROCESSED
self
.
summary_task_stored_88888
=
Task
.
objects
.
create
(
sas_id
=
88888
,
new_status
=
State
.
STORED
.
value
,
workflow
=
self
.
workflow_requantisation
,
outputs
=
{
"
tar_archive
"
:
[{
"
size
"
:
4885985280
,
"
basename
"
:
"
L185619_summaryCS.tar
"
,
"
nameroot
"
:
"
L185619_summaryCS
"
}]})
self
.
summary_task_processed_88888
=
Task
.
objects
.
create
(
sas_id
=
88888
,
new_status
=
State
.
PROCESSED
.
value
,
workflow
=
self
.
workflow_requantisation
,
outputs
=
{
"
tar_archive
"
:
[{
"
size
"
:
4885985280
,
"
basename
"
:
"
L185619_summaryCS.tar
"
,
"
nameroot
"
:
"
L185619_summaryCS
"
}]})
outputs
=
{
"
tar_archive
"
:
[{
"
size
"
:
4885985280
,
"
basename
"
:
"
L185619_summaryCS.tar
"
,
"
nameroot
"
:
"
L185619_summaryCS
"
}]})
def
test_no_summary_task
(
self
):
def
test_no_summary_task
(
self
):
"""
"""
test task that is not a summary task
test task that is not a summary task
"""
"""
actual
=
self
.
no_summary_task_77777
.
is_summary
actual
=
self
.
no_summary_task
.
is_summary
self
.
assertEqual
(
actual
,
False
)
self
.
assertEqual
(
actual
,
False
)
def
test_
summary_
task_defined
(
self
):
def
test_task_defined
_does_not_know_that_it_is_summary
(
self
):
"""
"""
test summary task, but before it knows that it becomes a summary task (which it only knows when
'
processed
'
)
test summary task, but before it knows that it becomes a summary task (which it only knows when
'
processed
'
)
"""
"""
actual
=
self
.
summary_task_defined_77777
.
is_summary
actual
=
self
.
summary_task_defined
.
is_summary
self
.
assertEqual
(
actual
,
False
)
self
.
assertEqual
(
actual
,
False
)
def
test_summary_task_stored
(
self
):
def
test_task_validated_knows_that_it_is_summary
(
self
):
"""
test summary task, at
'
stored
'
it should know that it is a summary task and return True)
"""
self
.
summary_task_validated_77777
.
save
()
actual
=
self
.
summary_task_validated_77777
.
is_summary
self
.
assertEqual
(
actual
,
True
)
def
test_task_processed_knows_that_it_is_summary
(
self
):
"""
"""
test summary task, at
'
stored
'
it should know that it is a summary task and return True)
test summary task, at
'
stored
'
it should know that it is a summary task and return True)
"""
"""
self
.
summary_task_
validated
.
save
()
self
.
summary_task_
processed_77777
.
save
()
actual
=
self
.
summary_task_
validated
.
is_summary
actual
=
bool
(
self
.
summary_task_
processed_77777
.
is_summary
)
self
.
assertEqual
(
actual
,
True
)
self
.
assertEqual
(
actual
,
True
)
def
test_summary_task_processed_goes_on_halt
(
self
):
"""
test summary task, at
'
stored
'
it should know that it is a summary task and return True)
"""
self
.
summary_task_processed_88888
.
save
()
actual
=
self
.
summary_task_processed_88888
.
resume
self
.
assertEqual
(
actual
,
False
)
def
test_activity_77777_not_is_processed
(
self
):
"""
activity 77777 should not be fully processed, because some tasks have not reached
'
processed
'
yet
"""
self
.
summary_task_processed_77777
.
save
()
activity
=
self
.
summary_task_processed_77777
.
activity
actual
=
bool
(
activity
.
is_processed
)
self
.
assertFalse
(
actual
)
def
test_activity_88888_is_processed
(
self
):
"""
SAS_ID 88888 should be is_processed, because all its tasks have status
'
processed
'
or
'
stored
'
"""
self
.
summary_task_stored_88888
.
save
()
self
.
summary_task_processed_88888
.
save
()
activity
=
self
.
summary_task_processed_88888
.
activity
actual
=
activity
.
is_processed
self
.
assertTrue
(
actual
)
\ No newline at end of file
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