From e8d6380553bdded04fc6f98e36a2972f1651ab0d Mon Sep 17 00:00:00 2001 From: Git-JK <1800012933@pku.edu.cn> Date: Sat, 31 Dec 2022 01:13:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=80=E7=82=B9=E5=B0=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/back-end/PressureDockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/back-end/PressureDockerfile b/app/back-end/PressureDockerfile index e71f1c5..f14dff4 100644 --- a/app/back-end/PressureDockerfile +++ b/app/back-end/PressureDockerfile @@ -1,6 +1,6 @@ FROM amazoncorretto:8 -ADD ./dormSystem.jar /app/ +ADD ./pressureDormSystem.jar /app/ WORKDIR /app -- Gitee From d3650c20b582074fdd6d475c9f216465fdc351a4 Mon Sep 17 00:00:00 2001 From: Git-JK <1800012933@pku.edu.cn> Date: Sat, 31 Dec 2022 02:41:35 +0800 Subject: [PATCH 2/2] orderAPI test --- test/API-TEST.py | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 test/API-TEST.py diff --git a/test/API-TEST.py b/test/API-TEST.py new file mode 100644 index 0000000..de4bf76 --- /dev/null +++ b/test/API-TEST.py @@ -0,0 +1,75 @@ +import random + +from locust import HttpUser, TaskSet, task + +token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIxIiwiZ2VuZGVyIjoiMCIsImlzcyI6ImF1dGgwIiwiZXhwIjoxNjcyNDMwMjE0LCJpYXQiOjE2NzI0MjMwMTR9.q3ngpuggZHQaC4gYbRvy0q8-lgayZgqvYfyKFDNV_Kk" + + +class ScriptTasks(TaskSet): + # @task + # # 查询我的队伍信息 + # def myTeam(self): + # data = {} + # header = { + # "Content": "application/json;charset=UTF-8", + # "Authorization": "Bearer " + token + # } + # response = self.client.get("/team/my", json=data, headers=header) + # print(response.text) + # + # @task + # # 创建队伍 + # def createTeam(self): + # alphabet = 'abcdefghijklmnopqrstuvwxyz!@#$%^&*()' + # data = { + # "name": random.sample(alphabet, 5), # 使用随机命名填充队伍名称 + # "describe": random.sample(alphabet, 5) + # } + # header = { + # "Content": "application/json;charset=UTF-8", + # "Authorization": "Bearer " + token + # } + # response = self.client.post("/team/create", json=data, headers=header) + # print(response.text) + # + # @task + # # 删除队伍 + # def delTeam(self): + # data = {} + # header = { + # "Content": "application/json;charset=UTF-8", + # "Authorization": "Bearer " + token + # } + # response = self.client.post("/team/del", json=data, headers=header) + # print(response.text) + + @task + # 提交订单 + def delTeam(self): + data = { + "group_id": random.randint(1, 118), # 使用随机命名填充队伍名称 + "building_id": random.randint(1, 5) + } + header = { + "Content": "application/json;charset=UTF-8", + "Authorization": "Bearer " + token + } + response = self.client.post("/order/create", json=data, headers=header) + print(response.text) + + +class UserBehavior(TaskSet): + tasks = {ScriptTasks: 15} + + +class WebsiteUser(HttpUser): + host = "http://43.143.251.91:8080" + tasks = [UserBehavior] + min_wait = 3000 # 单位为毫秒 + max_wait = 6000 # 单位为毫秒 + + +if __name__ == "__main__": + import os + + os.system("locust -f API-TEST.py --host=http://43.143.251.91:8080") -- Gitee