-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Improve rosemary maek:module command
- Loading branch information
1 parent
531f14a
commit 8491bd2
Showing
4 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import os | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
|
||
def get_host_for_testing(test_type): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from locust import HttpUser, TaskSet, task | ||
from core.environment.host import get_host_for_locust_testing | ||
|
||
|
||
class {{ blueprint_name | pascalcase }}Behavior(TaskSet): | ||
def on_start(self): | ||
self.index() | ||
|
||
@task | ||
def index(self): | ||
response = self.client.get("/{{ blueprint_name }}") | ||
|
||
if response.status_code != 200: | ||
print(f"{{ blueprint_name | pascalcase }} index failed: {response.status_code}") | ||
|
||
|
||
class {{ blueprint_name | pascalcase }}User(HttpUser): | ||
tasks = [{{ blueprint_name | pascalcase }}Behavior] | ||
min_wait = 5000 | ||
max_wait = 9000 | ||
host = get_host_for_locust_testing() |