From 7bcfec31c0ac62617b9227e24d28130a0365678f Mon Sep 17 00:00:00 2001 From: ilovenoah Date: Mon, 11 Mar 2024 14:32:06 +0900 Subject: [PATCH] changed compose file to test with locust --- docker-compose.yml | 19 +++++++++++++++++-- locustfile.py | 6 ++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 locustfile.py diff --git a/docker-compose.yml b/docker-compose.yml index 485f661..9e4ae46 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,9 +6,24 @@ services: tty: true volumes: - .:/code + networks: + - webserv_net + + locust: + container_name: webserv_locust + image: python:latest + volumes: + - .:/code + working_dir: /code + command: > + /bin/sh -c " + pip install locust && + locust + " ports: - - '9090:9090' - network_mode: "host" + - '8089:8089' + networks: + - webserv_net networks: webserv_net: diff --git a/locustfile.py b/locustfile.py new file mode 100644 index 0000000..542fa9b --- /dev/null +++ b/locustfile.py @@ -0,0 +1,6 @@ +from locust import HttpUser, task + +class HelloWorldUser(HttpUser): + @task + def hello_world(self): + self.client.get("/") \ No newline at end of file