diff --git a/locust/locustfile.py b/locust/locustfile.py deleted file mode 100644 index 4fe23d12c7..0000000000 --- a/locust/locustfile.py +++ /dev/null @@ -1,22 +0,0 @@ -from locust import HttpUser, between, task - -class Project(HttpUser): - wait_time = between(1, 5) - @task - def index(self): - self.client.get("/api/v2/projects/") - - # @task - # def projects(self): - # # headers = { - # # 'Authorization': f'Token TVRBeU5UQTBOVFkuWmFpU2dBLmNKaFRpbjYyX0NnbjBJUnIzNXhqZlEtUHRXQQ==' - # # } - # # for i in range(95, 100): - # # self.client.get("/projects/{}".format(i)) - # self.client.get("/api/v2/projects/") - -class Country(HttpUser): - wait_time = between(1, 5) - @task - def projects(self): - self.client.get("/api/v2/countries/") diff --git a/scripts/locust/docker-compose.yml b/scripts/locust/docker-compose.yml index 51eaf47569..b161c5f7b5 100644 --- a/scripts/locust/docker-compose.yml +++ b/scripts/locust/docker-compose.yml @@ -12,4 +12,4 @@ services: working_dir: /app/locust entrypoint: locust -f /app/locust/locustfile.py environment: - LOCUST_HOST: "https://tm.naxa.com.np" + LOCUST_HOST: "https://tm-fastapi.naxa.com.np" diff --git a/scripts/locust/locustfile.py b/scripts/locust/locustfile.py index 9752a61b5b..7b95be3f3f 100644 --- a/scripts/locust/locustfile.py +++ b/scripts/locust/locustfile.py @@ -10,6 +10,11 @@ def get_project(self): def get_comments(self): self.client.get("/api/v2/projects/114/comments/") +class ProjectList(TaskSet): + @task + def get_project(self): + self.client.get("/api/v2/projects/") + class GetSimilarProjects(TaskSet): @task def get_similar_projects(self): @@ -52,8 +57,9 @@ class ApiBenchmarkUser(HttpUser): # Dynamically select tasks based on environment variable or CLI parameter def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - task_name = os.getenv("TASK_SET", "project_and_comments").lower() - self.tasks = [task_mapping.get(task_name, ProjectAndComments)] + task_name = os.getenv("TASK_SET", "get_contributions").lower() + print(task_name, "The task name....") + self.tasks = [task_mapping.get(task_name, GetContributions)] '''