Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
user actions: added pytest-vcr for airflow
Browse files Browse the repository at this point in the history
  • Loading branch information
DonHaul committed Jul 26, 2024
1 parent 4424c53 commit 799feae
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 260 deletions.
2 changes: 1 addition & 1 deletion backoffice/.envs/local/.django
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ OPENSEARCH_HOST=opensearch:9200
OPENSEARCH_INDEX_PREFIX=backoffice-backend-local

# Airflow
AIRFLOW_BASE_URL=http://host.docker.internal:8080
AIRFLOW_BASE_URL=http://airflow-webserver:8080
AIRFLOW_TOKEN=YWlyZmxvdzphaXJmbG93
Original file line number Diff line number Diff line change
@@ -1,58 +1,28 @@
interactions:
- request:
body: '{"index":{"_id":"46f92be8-b7c4-4ab3-8496-83374558b3bc","_index":"backoffice-backend-test-workflows"}}
{"id":"46f92be8-b7c4-4ab3-8496-83374558b3bc","workflow_type":"AUTHOR_CREATE","data":{},"status":"running","is_update":false,"_created_at":"2024-07-25T15:29:20.618363+00:00","_updated_at":"2024-07-25T15:29:20.618369+00:00"}
'
headers:
connection:
- keep-alive
content-type:
- application/json
user-agent:
- opensearch-py/2.6.0 (Python 3.11.6)
method: POST
uri: http://opensearch:9200/_bulk?refresh=true
response:
body:
string: '{"took":14,"errors":false,"items":[{"index":{"_index":"backoffice-backend-test-workflows","_id":"46f92be8-b7c4-4ab3-8496-83374558b3bc","_version":1,"result":"created","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":27,"_primary_term":1,"status":201}}]}'
headers:
content-length:
- '284'
content-type:
- application/json; charset=UTF-8
status:
code: 200
message: OK
- request:
body: '{"dag_run_id": "46f92be8-b7c4-4ab3-8496-83374558b3bc", "conf": {"workflow_id":
"46f92be8-b7c4-4ab3-8496-83374558b3bc"}}'
body: '{"dag_run_id": "75a0cd6d-5914-4f5a-9a7a-26c026557b81", "conf": {"workflow_id":
"75a0cd6d-5914-4f5a-9a7a-26c026557b81"}}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Basic YWlyZmxvdzphaXJmbG93
Connection:
- keep-alive
Content-Length:
- '119'
Content-Type:
- application/json
User-Agent:
- python-requests/2.31.0
method: POST
uri: http://host.docker.internal:8080/api/v1/dags/author_create_initialization_dag/dagRuns
uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns
response:
body:
string: "{\n \"conf\": {\n \"workflow_id\": \"46f92be8-b7c4-4ab3-8496-83374558b3bc\"\n
string: "{\n \"conf\": {\n \"workflow_id\": \"75a0cd6d-5914-4f5a-9a7a-26c026557b81\"\n
\ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\":
\"46f92be8-b7c4-4ab3-8496-83374558b3bc\",\n \"data_interval_end\": \"2024-07-25T15:29:20.702377+00:00\",\n
\ \"data_interval_start\": \"2024-07-25T15:29:20.702377+00:00\",\n \"end_date\":
null,\n \"execution_date\": \"2024-07-25T15:29:20.702377+00:00\",\n \"external_trigger\":
true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-25T15:29:20.702377+00:00\",\n
\"75a0cd6d-5914-4f5a-9a7a-26c026557b81\",\n \"data_interval_end\": \"2024-07-26T12:45:01.130498+00:00\",\n
\ \"data_interval_start\": \"2024-07-26T12:45:01.130498+00:00\",\n \"end_date\":
null,\n \"execution_date\": \"2024-07-26T12:45:01.130498+00:00\",\n \"external_trigger\":
true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-26T12:45:01.130498+00:00\",\n
\ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n
\ \"state\": \"queued\"\n}\n"
headers:
Expand All @@ -63,7 +33,7 @@ interactions:
Content-Type:
- application/json
Date:
- Thu, 25 Jul 2024 15:29:20 GMT
- Fri, 26 Jul 2024 12:45:01 GMT
Server:
- gunicorn
X-Robots-Tag:
Expand All @@ -72,33 +42,29 @@ interactions:
code: 200
message: OK
- request:
body: '{"dry_run": false, "dag_run_id": "46f92be8-b7c4-4ab3-8496-83374558b3bc",
body: '{"dry_run": false, "dag_run_id": "75a0cd6d-5914-4f5a-9a7a-26c026557b81",
"reset_dag_runs": true}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Basic YWlyZmxvdzphaXJmbG93
Connection:
- keep-alive
Content-Length:
- '96'
Content-Type:
- application/json
User-Agent:
- python-requests/2.31.0
method: GET
uri: http://host.docker.internal:8080/api/v1/dags/author_create_initialization_dag/dagRuns/46f92be8-b7c4-4ab3-8496-83374558b3bc
uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns/75a0cd6d-5914-4f5a-9a7a-26c026557b81
response:
body:
string: "{\n \"conf\": {\n \"workflow_id\": \"46f92be8-b7c4-4ab3-8496-83374558b3bc\"\n
string: "{\n \"conf\": {\n \"workflow_id\": \"75a0cd6d-5914-4f5a-9a7a-26c026557b81\"\n
\ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\":
\"46f92be8-b7c4-4ab3-8496-83374558b3bc\",\n \"data_interval_end\": \"2024-07-25T15:29:20.702377+00:00\",\n
\ \"data_interval_start\": \"2024-07-25T15:29:20.702377+00:00\",\n \"end_date\":
null,\n \"execution_date\": \"2024-07-25T15:29:20.702377+00:00\",\n \"external_trigger\":
true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-25T15:29:20.702377+00:00\",\n
\"75a0cd6d-5914-4f5a-9a7a-26c026557b81\",\n \"data_interval_end\": \"2024-07-26T12:45:01.130498+00:00\",\n
\ \"data_interval_start\": \"2024-07-26T12:45:01.130498+00:00\",\n \"end_date\":
null,\n \"execution_date\": \"2024-07-26T12:45:01.130498+00:00\",\n \"external_trigger\":
true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-26T12:45:01.130498+00:00\",\n
\ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n
\ \"state\": \"queued\"\n}\n"
headers:
Expand All @@ -109,7 +75,7 @@ interactions:
Content-Type:
- application/json
Date:
- Thu, 25 Jul 2024 15:29:20 GMT
- Fri, 26 Jul 2024 12:45:01 GMT
Server:
- gunicorn
X-Robots-Tag:
Expand All @@ -118,29 +84,25 @@ interactions:
code: 200
message: OK
- request:
body: '{"dry_run": false, "dag_run_id": "46f92be8-b7c4-4ab3-8496-83374558b3bc",
body: '{"dry_run": false, "dag_run_id": "75a0cd6d-5914-4f5a-9a7a-26c026557b81",
"reset_dag_runs": true}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Basic YWlyZmxvdzphaXJmbG93
Connection:
- keep-alive
Content-Length:
- '96'
Content-Type:
- application/json
User-Agent:
- python-requests/2.31.0
method: GET
uri: http://host.docker.internal:8080/api/v1/dags/author_create_approved_dag/dagRuns/46f92be8-b7c4-4ab3-8496-83374558b3bc
uri: http://airflow-webserver:8080/api/v1/dags/author_create_approved_dag/dagRuns/75a0cd6d-5914-4f5a-9a7a-26c026557b81
response:
body:
string: "{\n \"detail\": \"DAGRun with DAG ID: 'author_create_approved_dag'
and DagRun ID: '46f92be8-b7c4-4ab3-8496-83374558b3bc' not found\",\n \"status\":
and DagRun ID: '75a0cd6d-5914-4f5a-9a7a-26c026557b81' not found\",\n \"status\":
404,\n \"title\": \"DAGRun not found\",\n \"type\": \"https://airflow.apache.org/docs/apache-airflow/2.8.3/stable-rest-api-ref.html#section/Errors/NotFound\"\n}\n"
headers:
Connection:
Expand All @@ -150,7 +112,7 @@ interactions:
Content-Type:
- application/problem+json
Date:
- Thu, 25 Jul 2024 15:29:20 GMT
- Fri, 26 Jul 2024 12:45:01 GMT
Server:
- gunicorn
X-Robots-Tag:
Expand All @@ -159,29 +121,25 @@ interactions:
code: 404
message: NOT FOUND
- request:
body: '{"dry_run": false, "dag_run_id": "46f92be8-b7c4-4ab3-8496-83374558b3bc",
body: '{"dry_run": false, "dag_run_id": "75a0cd6d-5914-4f5a-9a7a-26c026557b81",
"reset_dag_runs": true}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Basic YWlyZmxvdzphaXJmbG93
Connection:
- keep-alive
Content-Length:
- '96'
Content-Type:
- application/json
User-Agent:
- python-requests/2.31.0
method: GET
uri: http://host.docker.internal:8080/api/v1/dags/author_create_rejected_dag/dagRuns/46f92be8-b7c4-4ab3-8496-83374558b3bc
uri: http://airflow-webserver:8080/api/v1/dags/author_create_rejected_dag/dagRuns/75a0cd6d-5914-4f5a-9a7a-26c026557b81
response:
body:
string: "{\n \"detail\": \"DAGRun with DAG ID: 'author_create_rejected_dag'
and DagRun ID: '46f92be8-b7c4-4ab3-8496-83374558b3bc' not found\",\n \"status\":
and DagRun ID: '75a0cd6d-5914-4f5a-9a7a-26c026557b81' not found\",\n \"status\":
404,\n \"title\": \"DAGRun not found\",\n \"type\": \"https://airflow.apache.org/docs/apache-airflow/2.8.3/stable-rest-api-ref.html#section/Errors/NotFound\"\n}\n"
headers:
Connection:
Expand All @@ -191,7 +149,7 @@ interactions:
Content-Type:
- application/problem+json
Date:
- Thu, 25 Jul 2024 15:29:20 GMT
- Fri, 26 Jul 2024 12:45:01 GMT
Server:
- gunicorn
X-Robots-Tag:
Expand All @@ -206,18 +164,14 @@ interactions:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Basic YWlyZmxvdzphaXJmbG93
Connection:
- keep-alive
Content-Length:
- '0'
Content-Type:
- application/json
User-Agent:
- python-requests/2.31.0
method: DELETE
uri: http://host.docker.internal:8080/api/v1/dags/author_create_initialization_dag/dagRuns/46f92be8-b7c4-4ab3-8496-83374558b3bc
uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns/75a0cd6d-5914-4f5a-9a7a-26c026557b81
response:
body:
string: ''
Expand All @@ -227,7 +181,7 @@ interactions:
Content-Type:
- application/json
Date:
- Thu, 25 Jul 2024 15:29:20 GMT
- Fri, 26 Jul 2024 12:45:01 GMT
Server:
- gunicorn
X-Robots-Tag:
Expand All @@ -236,33 +190,29 @@ interactions:
code: 204
message: NO CONTENT
- request:
body: '{"dag_run_id": "46f92be8-b7c4-4ab3-8496-83374558b3bc", "conf": {"workflow_id":
"46f92be8-b7c4-4ab3-8496-83374558b3bc"}}'
body: '{"dag_run_id": "75a0cd6d-5914-4f5a-9a7a-26c026557b81", "conf": {"workflow_id":
"75a0cd6d-5914-4f5a-9a7a-26c026557b81"}}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- Basic YWlyZmxvdzphaXJmbG93
Connection:
- keep-alive
Content-Length:
- '119'
Content-Type:
- application/json
User-Agent:
- python-requests/2.31.0
method: POST
uri: http://host.docker.internal:8080/api/v1/dags/author_create_initialization_dag/dagRuns
uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns
response:
body:
string: "{\n \"conf\": {\n \"workflow_id\": \"46f92be8-b7c4-4ab3-8496-83374558b3bc\"\n
string: "{\n \"conf\": {\n \"workflow_id\": \"75a0cd6d-5914-4f5a-9a7a-26c026557b81\"\n
\ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\":
\"46f92be8-b7c4-4ab3-8496-83374558b3bc\",\n \"data_interval_end\": \"2024-07-25T15:29:21.049469+00:00\",\n
\ \"data_interval_start\": \"2024-07-25T15:29:21.049469+00:00\",\n \"end_date\":
null,\n \"execution_date\": \"2024-07-25T15:29:21.049469+00:00\",\n \"external_trigger\":
true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-25T15:29:21.049469+00:00\",\n
\"75a0cd6d-5914-4f5a-9a7a-26c026557b81\",\n \"data_interval_end\": \"2024-07-26T12:45:01.506311+00:00\",\n
\ \"data_interval_start\": \"2024-07-26T12:45:01.506311+00:00\",\n \"end_date\":
null,\n \"execution_date\": \"2024-07-26T12:45:01.506311+00:00\",\n \"external_trigger\":
true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-26T12:45:01.506311+00:00\",\n
\ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n
\ \"state\": \"queued\"\n}\n"
headers:
Expand All @@ -273,7 +223,7 @@ interactions:
Content-Type:
- application/json
Date:
- Thu, 25 Jul 2024 15:29:21 GMT
- Fri, 26 Jul 2024 12:45:01 GMT
Server:
- gunicorn
X-Robots-Tag:
Expand Down
Loading

0 comments on commit 799feae

Please sign in to comment.