Skip to content

Commit

Permalink
Adjust questionnaire detail
Browse files Browse the repository at this point in the history
  • Loading branch information
vknaisl committed Aug 12, 2024
1 parent 49b5efe commit b2e8747
Show file tree
Hide file tree
Showing 28 changed files with 740 additions and 503 deletions.
887 changes: 587 additions & 300 deletions Makefile

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
locust==2.15.0
locust==2.28.0
psycopg==3.1.9
psycopg2-binary==2.9.6
2 changes: 1 addition & 1 deletion tests/conf.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
WIZARD_API_TOKEN = "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE3MDc5OTg1NjIsInRlbmFudFV1aWQiOiIwMDA1NWMyNC01M2JkLTRiZGQtODAyMi0xNzk1ZjhlYmY3ZmYiLCJ0b2tlblV1aWQiOiJiZDI3Njk0NS05YTVkLTQxNzgtYmQyNy05NzFlNWVhNTkxNDIiLCJ1c2VyVXVpZCI6IjNlZjk2MDY3LThlN2EtNDc5ZS1hZTE4LTFiZTQ3ZjBlMjAzMiIsInZlcnNpb24iOjR9.LiGklocwHQOLCHDX_vweGjZKVsX1cVNo9xfQRPOKzZ3ZN9b5ss4P80hI71qgHBjTonbblMNqlxYHgGfHIZOUSNbboex6f0Tj0iaGIADpFhw6FsWNXBZ7BgUIfn6y974r-6iREX6PbYxz2vyTnJpOtSV7BwiBJ6nWc3uxLtG4oq7983YG1kuMj6OHnqxk6KKijefE9Cm4de9DdUNr5m-YJQXTTnnszQ3CsiRh68nzTFD6FZHO6xzNRdgham1GDxjUV9WDrWZXQkdTNRn0TUrIo7noExoNDJZUCDO5I-PSGA9Ev216ZCNRV2SqgD-Wgd0SawZdzmYrkhMRkPj5ofcZKVwGvslayvVApujUyOPtdJjxXezZTJ7N_zXJSPmV7fqafSIUMoKZOB33ROM89CY68xC6Ue3OluoINSKqzH3IfFzUVBvMDnC9jJfpjM6DiR1zrA49UiGNrnykS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9LeJr9xhsMTcDJNE8HdbE8pKqkXqWaXJuWdiyBBF8EQvZ3oXx40yy70EvUUzN__RGsA9bCwjrEkx3wYoOOdaJtE4P2Ku1IAD99mAXOe0"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from tests.authorized_base_test import AuthorizedBaseTest

QTN_UUID = '8796f923-75f7-4ae2-b53a-cc18ee0ec31d'
QTN_UUID = '4d76915c-0f75-4644-a095-cef027059794'


class BasicUser(AuthorizedBaseTest):
Expand Down
16 changes: 16 additions & 0 deletions tests/questionnaire_detail_comments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from locust import task

from tests.authorized_base_test import AuthorizedBaseTest

QTN_UUID = '4d76915c-0f75-4644-a095-cef027059794'
PATH='1e85da40-bbfc-4180-903e-6c569ed2da38.73d686bd-7939-412e-8631-502ee6d9ea7b'


class BasicUser(AuthorizedBaseTest):

@task(5)
def get_questionnaire_settings(self):
self.client.get(
url=f'/questionnaires/{QTN_UUID}/comments?path={PATH}',
headers=self.headers,
)
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions tests/questionnaire_detail_questionnaire.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from locust import task

from tests.authorized_base_test import AuthorizedBaseTest

QTN_UUID = '4d76915c-0f75-4644-a095-cef027059794'


class BasicUser(AuthorizedBaseTest):

@task(5)
def get_questionnaire(self):
self.client.get(
url=f'/questionnaires/{QTN_UUID}/questionnaire',
headers=self.headers,
)
File renamed without changes.
15 changes: 15 additions & 0 deletions tests/questionnaire_detail_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from locust import task

from tests.authorized_base_test import AuthorizedBaseTest

QTN_UUID = '4d76915c-0f75-4644-a095-cef027059794'


class BasicUser(AuthorizedBaseTest):

@task(5)
def get_questionnaire_settings(self):
self.client.get(
url=f'/questionnaires/{QTN_UUID}/settings',
headers=self.headers,
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
41 changes: 22 additions & 19 deletions tools/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,30 @@
T_20 = TestVariant(20)
T_40 = TestVariant(40)
T_80 = TestVariant(80)
T_120 = TestVariant(160)
T_160 = TestVariant(160)

TESTS = [
Test('config-bootstrap', [T_20, T_40, T_80, T_120]),
Test('document-template-detail', [T_20, T_40, T_80, T_120]),
Test('document-template-list', [T_20, T_40, T_80, T_120]),
Test('document-template-suggestions', [T_20, T_40, T_80, T_120]),
Test('package-detail', [T_20, T_40, T_80, T_120]),
Test('package-list', [T_20, T_40, T_80, T_120]),
Test('package-suggestions', [T_20, T_40, T_80, T_120]),
Test('questionnaire-detail', [T_20]),
Test('questionnaire-detail-documents', [T_20, T_40, T_80, T_120]),
Test('questionnaire-detail-events', [T_20]),
Test('questionnaire-detail-report', [T_20]),
Test('questionnaire-detail-versions', [T_20, T_40, T_80, T_120]),
Test('questionnaire-importer-suggestion', [T_20, T_40, T_80, T_120]),
Test('questionnaire-list', [T_20, T_40]),
Test('questionnaire-project-tag-suggestion', [T_20, T_40, T_80, T_120]),
Test('usage', [T_20, T_40, T_80, T_120]),
Test('users-list', [T_20, T_40, T_80, T_120]),
Test('users-suggestion', [T_20, T_40, T_80, T_120]),
Test('config_bootstrap', [T_20, T_40, T_80, T_160]),
Test('document_template_detail', [T_20, T_40, T_80, T_160]),
Test('document_template_list', [T_20, T_40, T_80, T_160]),
Test('document_template_suggestions', [T_20, T_40, T_80, T_160]),
Test('package_detail', [T_20, T_40, T_80, T_160]),
Test('package_list', [T_20, T_40, T_80, T_160]),
Test('package_suggestions', [T_20, T_40, T_80, T_160]),
Test('questionnaire_detail', [T_20, T_40, T_80, T_160]),
Test('questionnaire_detail_comments', [T_20, T_40, T_80, T_160]),
Test('questionnaire_detail_documents', [T_20, T_40, T_80, T_160]),
Test('questionnaire_detail_events', [T_20, T_40, T_80, T_160]),
Test('questionnaire_detail_questionnaire', [T_20, T_40, T_80, T_160]),
Test('questionnaire_detail_report', [T_20]),
Test('questionnaire_detail_settings', [T_20, T_40, T_80, T_160]),
Test('questionnaire_detail_versions', [T_20, T_40, T_80, T_160]),
Test('questionnaire_importer_suggestion', [T_20, T_40, T_80, T_160]),
Test('questionnaire_list', [T_20, T_40, T_80, T_160]),
Test('questionnaire_project_tag_suggestion', [T_20, T_40, T_80, T_160]),
Test('usage', [T_20, T_40, T_80, T_160]),
Test('users_list', [T_20, T_40, T_80, T_160]),
Test('users_suggestion', [T_20, T_40, T_80, T_160]),
]

WIZARD_USERNAME = '[email protected]'
Expand Down
2 changes: 1 addition & 1 deletion tools/database_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def load_test(test_name: str, users: int) -> [Endpoint]:
with open(f'csv/{test_name}-{users}_stats.csv', encoding='utf-8') as f:
with open(f'csv/{test_name}_{users}_stats.csv', encoding='utf-8') as f:
lines = list(csv.reader(f, delimiter=','))
endpoints = []
for line in lines:
Expand Down
64 changes: 40 additions & 24 deletions tools/grafana_generator.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
import subprocess

import tests.questionnaire_detail as questionnaire_detail
import tests.questionnaire_detail_comments as questionnaire_detail_comments
import tests.questionnaire_detail_documents as questionnaire_detail_documents
import tests.questionnaire_detail_events as questionnaire_detail_events
import tests.questionnaire_detail_questionnaire as questionnaire_detail_questionnaire
import tests.questionnaire_detail_report as questionnaire_detail_report
import tests.questionnaire_detail_settings as questionnaire_detail_settings
import tests.questionnaire_detail_versions as questionnaire_detail_versions
from tools.grafana_template import create_target, create_dashboard

fast_targets_array = [
create_target("GET /wizard-api/configs/bootstrap", "GET", "url = '/wizard-api/configs/bootstrap'"),
create_target("GET /wizard-api/document-templates", "GET", "url = '/wizard-api/document-templates'"),
create_target("GET /wizard-api/packages", "GET", "url = '/wizard-api/packages'"),
create_target("GET /wizard-api/packages/suggestions", "GET", "url = '/wizard-api/packages/suggestions'"),
create_target("GET /wizard-api/packages/<id>", "GET","url LIKE '/wizard-api/packages/%' AND url != '/wizard-api/packages/suggestions'"),
create_target("GET /wizard-api/questionnaires/project-tags/suggestions", "GET","url = '/wizard-api/questionnaires/project-tags/suggestions'"),
create_target("GET /wizard-api/usage", "GET","url = '/wizard-api/usage'"),
create_target("GET /wizard-api/users", "GET","url LIKE '/wizard-api/users%'"),
]

slow_targets_array = [
create_target("GET /wizard-api/document-templates/suggestions", "GET","url = '/wizard-api/document-templates/suggestions'"),
create_target("GET /wizard-api/document-templates/<id>", "GET","url LIKE '/wizard-api/document-templates/%' AND url != '/wizard-api/document-templates/suggestions'"),
create_target("GET /wizard-api/questionnaires", "GET", "url = '/wizard-api/questionnaires'"),
create_target("GET /wizard-api/questionnaires/<id>", "GET", "url = '/wizard-api/questionnaires/8796f923-75f7-4ae2-b53a-cc18ee0ec31d'"),
create_target("GET /wizard-api/questionnaires/<id>/documents", "GET", "url = '/wizard-api/questionnaires/8796f923-75f7-4ae2-b53a-cc18ee0ec31d/documents'"),
create_target("GET /wizard-api/questionnaires/<id>/events", "GET", "url = '/wizard-api/questionnaires/8796f923-75f7-4ae2-b53a-cc18ee0ec31d/events'"),
create_target("GET /wizard-api/questionnaires/<id>/reports", "GET", "url = '/wizard-api/questionnaires/8796f923-75f7-4ae2-b53a-cc18ee0ec31d/reports'"),
create_target("GET /wizard-api/questionnaires/<id>/versions", "GET", "url = '/wizard-api/questionnaires/8796f923-75f7-4ae2-b53a-cc18ee0ec31d/versions'"),
create_target("GET /wizard-api/questionnaire-importers/suggestions", "GET","url = '/wizard-api/questionnaire-importers/suggestions'"),
]
def create_targets_array(user):
return [
create_target(user, "GET /wizard-api/configs/bootstrap", "GET", "url = '/wizard-api/configs/bootstrap'"),
create_target(user, "GET /wizard-api/document-templates", "GET", "url = '/wizard-api/document-templates'"),
create_target(user, "GET /wizard-api/document-templates/suggestions", "GET","url = '/wizard-api/document-templates/suggestions'"),
create_target(user, "GET /wizard-api/document-templates/<id>", "GET","url LIKE '/wizard-api/document-templates/%' AND url != '/wizard-api/document-templates/suggestions'"),
create_target(user, "GET /wizard-api/packages", "GET", "url = '/wizard-api/packages'"),
create_target(user, "GET /wizard-api/packages/suggestions", "GET", "url = '/wizard-api/packages/suggestions'"),
create_target(user, "GET /wizard-api/packages/<id>", "GET","url LIKE '/wizard-api/packages/%' AND url != '/wizard-api/packages/suggestions'"),
create_target(user, "GET /wizard-api/questionnaires", "GET", "url = '/wizard-api/questionnaires'"),
create_target(user, "GET /wizard-api/questionnaires/<id>", "GET",f"""url = '/wizard-api/questionnaires/{questionnaire_detail.QTN_UUID}'"""),
create_target(user, "GET /wizard-api/questionnaires/<id>/comments", "GET",f"""url = '/wizard-api/questionnaires/{questionnaire_detail_comments.QTN_UUID}?path={questionnaire_detail_comments.PATH}'"""),
create_target(user, "GET /wizard-api/questionnaires/<id>/documents", "GET",f"""url = '/wizard-api/questionnaires/{questionnaire_detail_documents.QTN_UUID}'"""),
create_target(user, "GET /wizard-api/questionnaires/<id>/events", "GET",f"""url = '/wizard-api/questionnaires/{questionnaire_detail_events.QTN_UUID}'"""),
create_target(user, "GET /wizard-api/questionnaires/<id>/questionnaire", "GET",f"""url = '/wizard-api/questionnaires/{questionnaire_detail_questionnaire.QTN_UUID}'"""),
create_target(user, "GET /wizard-api/questionnaires/<id>/report", "GET",f"""url = '/wizard-api/questionnaires/{questionnaire_detail_report.QTN_UUID}'"""),
create_target(user, "GET /wizard-api/questionnaires/<id>/settings", "GET",f"""url = '/wizard-api/questionnaires/{questionnaire_detail_settings.QTN_UUID}'"""),
create_target(user, "GET /wizard-api/questionnaires/<id>/versions", "GET",f"""url = '/wizard-api/questionnaires/{questionnaire_detail_versions.QTN_UUID}'"""),
create_target(user, "GET /wizard-api/questionnaires/project-tags/suggestions", "GET","url = '/wizard-api/questionnaires/project-tags/suggestions'"),
create_target(user, "GET /wizard-api/questionnaire-importers/suggestions", "GET","url = '/wizard-api/questionnaire-importers/suggestions'"),
create_target(user, "GET /wizard-api/usage", "GET", "url = '/wizard-api/usage'"),
create_target(user, "GET /wizard-api/users", "GET", "url LIKE '/wizard-api/users%' AND url != '/wizard-api/users/suggestions'"),
create_target(user, "GET /wizard-api/users/suggestions", "GET","url = '/wizard-api/users/suggestions'"),
]

fast_targets = ','.join(fast_targets_array)
slow_targets = ','.join(slow_targets_array)

dashboard = create_dashboard(fast_targets, slow_targets)
panels = [
(20, ','.join(create_targets_array(20))),
(40, ','.join(create_targets_array(40))),
(80, ','.join(create_targets_array(80))),
(160, ','.join(create_targets_array(160))),
]

dashboard = create_dashboard(panels)
subprocess.run("pbcopy", text=True, input=dashboard)
Loading

0 comments on commit b2e8747

Please sign in to comment.