Skip to content

Commit 77fe227

Browse files
committed
loadgenerator follow redirects
1 parent 9583e2e commit 77fe227

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

helm/templates/loadgenerator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ spec:
7474
RETRY_INTERVAL=10
7575
for i in $(seq 1 $MAX_RETRIES); do
7676
echo "Attempt $i: Pinging frontend: ${FRONTEND_ADDR}..."
77-
STATUSCODE=$(wget --server-response ${FRONTEND_ADDR} 2>&1 | awk '/^ HTTP/{print $2}')
77+
STATUSCODE=$(wget --server-response http://${FRONTEND_ADDR} 2>&1 | awk '/^ HTTP/{print $2}')
7878
if [ $STATUSCODE -eq 200 ]; then
7979
echo "Frontend is reachable."
8080
exit 0

src/loadgenerator/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ COPY locustfile.py .
4242
# enable gevent support in debugger
4343
ENV GEVENT_SUPPORT=True
4444

45-
ENTRYPOINT ["/bin/sh", "-c", "locust --host=\"$FRONTEND_ADDR\" --headless -u \"${USERS}\" -r \"${RATE}\""]
45+
# Will automatically follow redirects in case HTTP -> HTTPS redirect in place
46+
ENTRYPOINT ["/bin/sh", "-c", "locust --host=\"http://$FRONTEND_ADDR\" --headless -u \"${USERS}\" -r \"${RATE}\""]
4647

src/loadgenerator/locustfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616

1717
import random
18-
from locust import FastHttpUser, TaskSet, between
18+
from locust import HttpUser, TaskSet, between
1919
from faker import Faker
2020
import datetime
2121
fake = Faker()
@@ -87,6 +87,6 @@ def on_start(self):
8787
viewCart: 3,
8888
checkout: 1}
8989

90-
class WebsiteUser(FastHttpUser):
90+
class WebsiteUser(HttpUser):
9191
tasks = [UserBehavior]
9292
wait_time = between(1, 10)

0 commit comments

Comments
 (0)