Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Data Logistics Service
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
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eFlows4HPC WP2
Data Logistics Service
Commits
d7a73b26
Commit
d7a73b26
authored
3 years ago
by
Jedrzej Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
adding test stub
parent
810c16d6
No related branches found
No related tags found
No related merge requests found
Pipeline
#77452
failed
3 years ago
Stage: test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+2
-0
2 additions, 0 deletions
.gitlab-ci.yml
tests/test_b2shareoperator.py
+22
-0
22 additions, 0 deletions
tests/test_b2shareoperator.py
tests/test_dag.py
+13
-0
13 additions, 0 deletions
tests/test_dag.py
with
37 additions
and
0 deletions
.gitlab-ci.yml
+
2
−
0
View file @
d7a73b26
...
...
@@ -15,6 +15,7 @@ test:
before_script
:
-
airflow db init
-
pip install -r requirements.txt
-
pip install nose==1.3.7
-
airflow connections add --conn-uri https://b2share-testing.fz-juelich.de/ default_b2share
script
:
-
ls
...
...
@@ -23,4 +24,5 @@ test:
-
airflow dags list
-
airflow connections list
-
airflow dags test firsto 2021-08-18
-
nosetests
This diff is collapsed.
Click to expand it.
tests/test_b2shareoperator.py
0 → 100644
+
22
−
0
View file @
d7a73b26
import
unittest
from
airflow.utils.state
import
State
from
dags.b2shareoperator
import
B2ShareOperator
from
airflow
import
DAG
from
airflow.models.taskinstance
import
TaskInstance
DEFAULT_DATE
=
'
2019-10-03
'
TEST_DAG_ID
=
'
test_my_custom_operator
'
class
B2ShareOperatorTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
dag
=
DAG
(
TEST_DAG_ID
,
schedule_interval
=
'
@daily
'
,
default_args
=
{
'
start_date
'
:
DEFAULT_DATE
})
self
.
op
=
B2ShareOperator
(
dag
=
self
.
dag
,
task_id
=
'
test
'
,
)
self
.
ti
=
TaskInstance
(
task
=
self
.
op
,
execution_date
=
DEFAULT_DATE
)
def
test_execute_no_trigger
(
self
):
self
.
ti
.
run
(
ignore_ti_state
=
True
)
assert
self
.
ti
.
state
==
State
.
SUCCESS
# Assert something related to tasks results
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/test_dag.py
0 → 100644
+
13
−
0
View file @
d7a73b26
from
airflow.models
import
DagBag
import
unittest
class
TestADag
(
unittest
.
TestCase
):
@classmethod
def
setUpClass
(
cls
):
cls
.
dagbag
=
DagBag
()
def
test_dag_loaded
(
self
):
dag
=
self
.
dagbag
.
get_dag
(
dag_id
=
'
firsto
'
)
assert
self
.
dagbag
.
import_errors
==
{}
assert
dag
is
not
None
assert
len
(
dag
.
tasks
)
==
1
\ 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