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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASTRON SDC
atdb-ldv
Commits
d2484344
Commit
d2484344
authored
1 year ago
by
Nico Vermaas
Browse files
Options
Downloads
Patches
Plain Diff
add unit tests
parent
1f13ae03
No related branches found
No related tags found
1 merge request
!341
SDC-1188 - final merge
Pipeline
#72722
passed
1 year ago
Stage: test
Stage: build
Stage: deploy_to_test
Stage: deploy_to_production
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
atdb/taskdatabase/tests/test_update_activity.py
+79
-6
79 additions, 6 deletions
atdb/taskdatabase/tests/test_update_activity.py
with
79 additions
and
6 deletions
atdb/taskdatabase/tests/test_update_activity.py
+
79
−
6
View file @
d2484344
...
...
@@ -9,17 +9,39 @@ class TestUpdateActivity(TestCase):
self
.
workflow_requantisation
.
save
()
self
.
task1
=
Task
.
objects
.
create
(
sas_id
=
12345
,
filter
=
"
nv_19feb_2024
"
,
status
=
'
stored
'
,
workflow
=
self
.
workflow_requantisation
,
calculated_qualities
=
{
"
per_task
"
:
"
good
"
,
"
per_sasid
"
:
"
good
"
})
self
.
task2
=
Task
.
objects
.
create
(
sas_id
=
12345
,
status
=
'
scrubbed
'
,
workflow
=
self
.
workflow_requantisation
,
calculated_qualities
=
{
"
per_task
"
:
"
good
"
,
"
per_sasid
"
:
"
good
"
})
self
.
task3
=
Task
.
objects
.
create
(
sas_id
=
12345
,
status
=
'
archived
'
,
workflow
=
self
.
workflow_requantisation
,
archive
=
{
"
path_to_lta
"
:
"
https://lta.lofar.eu//Lofar?project=ALL&mode=show_dataproducts_pipe&product=PulsarPipeline&pipeline_object_id=1101AB934B386BD5E063164A17AC38B9
"
,
"
lta_object_id
"
:
"
1101AB934B386BD5E063164A17AC38B9
"
,
"
sas_id_archived
"
:
"
1219995
"
})
"
path_to_lta
"
:
"
https://lta.lofar.eu//Lofar?project=ALL&mode=show_dataproducts_pipe&product=PulsarPipeline&pipeline_object_id=1101AB934B386BD5E063164A17AC38B9
"
,
"
lta_object_id
"
:
"
1101AB934B386BD5E063164A17AC38B9
"
,
"
sas_id_archived
"
:
"
1219995
"
},
size_to_process
=
1000
,
size_processed
=
500
)
self
.
task4
=
Task
.
objects
.
create
(
sas_id
=
12345
,
status
=
'
finished
'
,
workflow
=
self
.
workflow_requantisation
,
archive
=
{
"
path_to_lta
"
:
"
https://lta.lofar.eu//Lofar?project=ALL&mode=show_dataproducts_pipe&product=PulsarPipeline&pipeline_object_id=1101AB934B386BD5E063164A17AC38B9
"
,
"
lta_object_id
"
:
"
1101AB934B386BD5E063164A17AC38B9
"
,
"
sas_id_archived
"
:
"
1219995
"
},
size_to_process
=
1000
,
size_processed
=
500
)
self
.
task5
=
Task
.
objects
.
create
(
sas_id
=
12345
,
status
=
'
archived_failed
'
,
workflow
=
self
.
workflow_requantisation
,
size_to_process
=
1000
,
size_processed
=
500
)
def
test_created_activity
(
self
):
...
...
@@ -29,6 +51,7 @@ class TestUpdateActivity(TestCase):
actual
=
activity
.
sas_id
self
.
assertEqual
(
actual
,
12345
)
def
test_stored
(
self
):
# test if the activity gets the calculated quality of the sas_id of the stored task
...
...
@@ -37,12 +60,62 @@ class TestUpdateActivity(TestCase):
actual
=
activity
.
calculated_quality
self
.
assertEqual
(
actual
,
"
good
"
)
def
test_archived
(
self
):
def
test_scrubbed
(
self
):
# test if the activity gets the ingested_fraction of an archived task
activity
=
self
.
task2
.
activity
actual
=
activity
.
ingestq_status
self
.
assertEqual
(
actual
,
{
'
archived
'
:
1
})
self
.
assertEqual
(
actual
,
{
'
scrubbed
'
:
1
})
actual
=
activity
.
ingested_fraction
self
.
assertEqual
(
actual
,
0
)
def
test_archived
(
self
):
# test if the activity gets the ingested_fraction of an archived task
activity
=
self
.
task3
.
activity
actual
=
activity
.
ingestq_status
self
.
assertEqual
(
actual
,
{
'
scrubbed
'
:
1
,
'
archived
'
:
1
})
actual
=
activity
.
archive
[
'
sas_id_archived
'
]
self
.
assertEqual
(
actual
,
"
1219995
"
)
def
test_finished
(
self
):
# test if the activity gets the ingested_fraction of an archived task
activity
=
self
.
task4
.
activity
actual
=
activity
.
ingestq_status
self
.
assertEqual
(
actual
,
{
'
scrubbed
'
:
1
,
'
archived
'
:
1
})
actual
=
activity
.
archive
[
'
sas_id_archived
'
]
self
.
assertEqual
(
actual
,
"
1219995
"
)
def
test_failed
(
self
):
# test if the activity gets the ingested_fraction of an archived task
activity
=
self
.
task5
.
activity
actual
=
activity
.
finished_fraction
self
.
assertEqual
(
actual
,
33
)
actual
=
activity
.
total_size
self
.
assertEqual
(
actual
,
3000
)
actual
=
activity
.
remaining
self
.
assertEqual
(
actual
,
2000
)
def
test_filter_and_workflow
(
self
):
# test if the activity gets the calculated quality of the sas_id of the stored task
activity
=
self
.
task1
.
activity
actual
=
activity
.
filter
self
.
assertEqual
(
actual
,
"
nv_19feb_2024
"
)
actual
=
activity
.
workflow_id
self
.
assertEqual
(
actual
,
22
)
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