From 6fa1f679075338f49f89b7f64cd2f0f047925500 Mon Sep 17 00:00:00 2001 From: skoulouzis Date: Mon, 11 Sep 2023 14:30:09 +0200 Subject: [PATCH] added doc in README.md to test submit with token --- README.md | 14 ++--- vre-panel/.env.test | 3 - vreapis/tests/__init__.py | 0 .../workflows/submit_workflow_req_body.json | 58 +++++++++++++++++++ vreapis/workflows/views.py | 4 ++ 5 files changed, 69 insertions(+), 10 deletions(-) create mode 100644 vreapis/tests/__init__.py create mode 100644 vreapis/tests/resources/workflows/submit_workflow_req_body.json diff --git a/README.md b/README.md index 7747fb1..281f133 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,7 @@ conda install -c conda-forge tilt conda install -c conda-forge minikube ``` -Follow step 3 of the [minikube ingress-dns setup guide](https://minikube.sigs.k8s.io/docs/handbook/addons/ingress-dns/). - -For Ubuntu 20.04, before step 3, you need to install resolvconf: - -```shell -sudo apt install resolvconf -``` +Follow step 3 section 'Linux OS with Network Manager' of the [minikube ingress-dns setup guide](https://minikube.sigs.k8s.io/docs/handbook/addons/ingress-dns/). #### Add secrets @@ -217,6 +211,12 @@ echo -n $ARGO_TOKEN | base64 -w 0 ) ``` +## Test Submit Workflow + +```shell +curl -X POST "http://paas.minikube.test/vre-api-test/api/workflows/submit/" -H "Authorization: Token ${accessToken}" -H "Content-Type: application/json" -d "@vreapis/tests/resources/workflows/submit_workflow_req_body.json" +``` + # Authorization diff --git a/vre-panel/.env.test b/vre-panel/.env.test index 4f004e9..0a5efa4 100644 --- a/vre-panel/.env.test +++ b/vre-panel/.env.test @@ -1,5 +1,2 @@ API_BASE_PATH=/vre-api-test/api FRONTEND_BASE_PATH=/vreapp - - -NEXTAUTH_URL=https://paas.minikube.test/vreapp/api/auth diff --git a/vreapis/tests/__init__.py b/vreapis/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/vreapis/tests/resources/workflows/submit_workflow_req_body.json b/vreapis/tests/resources/workflows/submit_workflow_req_body.json new file mode 100644 index 0000000..4e64afa --- /dev/null +++ b/vreapis/tests/resources/workflows/submit_workflow_req_body.json @@ -0,0 +1,58 @@ +{ + "vlab": "laserfarm", + "workflow_payload": { + "workflow": { + "apiVersion": "argoproj.io/v1alpha1", + "kind": "Workflow", + "metadata": { + "generateName": "n-a-a-vre-dev-user-name-at-domain-com-", + "labels": { + "vlab_slug": "laserfarm" + } + }, + "spec": { + "entrypoint": "n-a-a-vre-dev-user-name-at-domain-com", + "arguments": { + "parameters": null + }, + "templates": [ + { + "name": "n-a-a-vre-dev-user-name-at-domain-com", + "dag": { + "tasks": [ + { + "name": "process-a-list-dev-user-name-at-domain-com-0942899", + "template": "process-a-list-dev-user-name-at-domain-com-0942899-tmp" + } + ] + } + }, + { + "name": "process-a-list-dev-user-name-at-domain-com-0942899-tmp", + "outputs": { + "parameters": [ + { + "name": "b_list_886fb14", + "valueFrom": { + "path": "/tmp/b_list_886fb14.json" + } + } + ] + }, + "container": { + "image": "qcdis/process-a-list-dev-user-name-at-domain-com", + "imagePullPolicy": "Always", + "command": [ + "/bin/bash", + "-c" + ], + "args": [ + "source /venv/bin/activate; python process-a-list-dev-user-name-at-domain-com.py --id \"886fb14\";" + ] + } + } + ] + } + } + } +} diff --git a/vreapis/workflows/views.py b/vreapis/workflows/views.py index 91583d3..0a5a311 100644 --- a/vreapis/workflows/views.py +++ b/vreapis/workflows/views.py @@ -130,7 +130,11 @@ def submit(self, request, *args, **kwargs): call_url = argo_api_wf_url + '/' + namespace workflow = request.data['workflow_payload'] + if not workflow: + return Response({'message': 'Workflow payload not set'}, status=400) vlab_slug = request.data['vlab'] + if not vlab_slug: + return Response({'message': 'Virtual Lab not set'}, status=400) if not argo_api_token: return Response({'message': 'Argo API token not set'}, status=500)