This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f05b5ea
commit 8ca6f99
Showing
4 changed files
with
46 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -10,4 +10,7 @@ build | |
*.ipr | ||
*.iws | ||
build-idea/ | ||
out/ | ||
out/ | ||
|
||
venv/ | ||
__pycache__/ |
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,24 @@ | ||
import json | ||
from locust import HttpUser, between, task | ||
|
||
class OpenSearchUBIClient(HttpUser): | ||
wait_time = between(1, 2) | ||
|
||
@task | ||
def event_task(self): | ||
headers = { | ||
"Content-Type": "application/json" | ||
} | ||
data = { | ||
"type": "instant-search", | ||
"keywords": "khgkj", | ||
"timestamp": "1705596607509", | ||
"url": "file:///C:/jason/_dev/search/OpenSearch/src/search-collector/demo/order.html", | ||
"ref": "", | ||
"lang": "en-US", | ||
"session": "npckcy4", | ||
"channel": "demo-channel", | ||
"query": "" | ||
} | ||
|
||
self.client.post("/_plugins/ubi/mystore", headers=headers, json=data) |
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 @@ | ||
locust==2.23.1 |
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,17 @@ | ||
#!/bin/bash -e | ||
|
||
# Delete the store if it exists. | ||
curl -X DELETE http://localhost:9200/_plugins/ubi/mystore | ||
|
||
# Create the store | ||
curl -X PUT http://localhost:9200/_plugins/ubi/mystore | ||
|
||
# Insert events | ||
locust -f load-test.py --headless -u 1 -r 1 --run-time 10s --host http://localhost:9200 | ||
|
||
# Let events index. | ||
sleep 2 | ||
|
||
# Get count of indexed events. | ||
EVENTS=`curl -s http://localhost:9200/.mystore_events/_count | jq .count` | ||
echo "Found $EVENTS indexed" |