Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load testing configuration #531

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Fix sitemap caching"
This reverts commit 052f250.
  • Loading branch information
CamLamb committed Dec 18, 2023
commit 5e6175de5abc5776dbb485c43aeb334d9bab13e7
17 changes: 11 additions & 6 deletions locustfile.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
"teams",
"tools",
]
SITEMAP_URLS: list[str] = []


def clean_path(path: str) -> str:
@@ -96,18 +95,20 @@ def team_employee_experience(self):


class SitemapBrowsing(TaskSet):
sitemap_urls: list[str] = []

def get_random_path_from_sitemap(self):
if not SITEMAP_URLS:
if not self.sitemap_urls:
sitemap_xml = self.client.get(
"sitemap.xml",
headers=sso_headers,
)

root = ET.fromstring(sitemap_xml.text)
SITEMAP_URLS = [url[0].text for url in root]
self.sitemap_urls = [url[0].text for url in root]

random_index = random.randint(0, len(SITEMAP_URLS) - 1)
random_url = SITEMAP_URLS[random_index]
random_index = random.randint(0, len(self.sitemap_urls) - 1)
random_url = self.sitemap_urls[random_index]
return get_url_path(random_url)

@task(80)
@@ -120,5 +121,9 @@ def random_page_from_sitemap(self):


class User(HttpUser):
tasks = [SearchBrowsing, NormalBrowsing, SitemapBrowsing, 4]
tasks = [
SearchBrowsing,
NormalBrowsing,
SitemapBrowsing,
]
wait_time = between(5, 9)