naming convention and variable load
This commit is contained in:
@@ -6,8 +6,8 @@ COPY requirements.txt /load/
|
|||||||
|
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
COPY run.sh /load/
|
COPY entrypoint.sh /load/
|
||||||
COPY robot-shop.py /load/
|
COPY robot-shop.py /load/
|
||||||
|
|
||||||
CMD ["./run.sh"]
|
CMD ["./entrypoint.sh"]
|
||||||
|
|
||||||
|
27
load-gen/entrypoint.sh
Executable file
27
load-gen/entrypoint.sh
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -z "$HOST" ]
|
||||||
|
then
|
||||||
|
echo "HOST env not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TEST=$(echo "$HOST" | egrep '^http://[a-z0-9]+')
|
||||||
|
if [ -z "$TEST" ]
|
||||||
|
then
|
||||||
|
echo "Host must start with http://"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "$NUM_CLIENTS" | egrep -q '^[0-9]+$'
|
||||||
|
then
|
||||||
|
CLIENTS=${NUM_CLIENTS:-1}
|
||||||
|
else
|
||||||
|
echo "$NUM_CLIENTS is not a number falling back to 1"
|
||||||
|
CLIENTS=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting load with $CLIENTS clients"
|
||||||
|
|
||||||
|
locust -f robot-shop.py --host "$HOST" --no-web -c $CLIENTS -r 1
|
||||||
|
|
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Changing the NUM_CLIENTS environment variable varies the load on the application
|
||||||
|
# The bigger the number the more requests, the bigger the load
|
||||||
|
|
||||||
# get the tag info
|
# get the tag info
|
||||||
eval $(egrep '[A-Z]+=' ../.env)
|
eval $(egrep '[A-Z]+=' ../.env)
|
||||||
|
|
||||||
@@ -11,5 +14,6 @@ docker run \
|
|||||||
--rm \
|
--rm \
|
||||||
--network=host \
|
--network=host \
|
||||||
-e 'HOST=http://localhost:8080' \
|
-e 'HOST=http://localhost:8080' \
|
||||||
|
-e 'NUM_CLIENTS=1' \
|
||||||
${REPO}/rs-load:${TAG}
|
${REPO}/rs-load:${TAG}
|
||||||
|
|
||||||
|
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ -z "$HOST" ]
|
|
||||||
then
|
|
||||||
echo "HOST env not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
TEST=$(echo "$HOST" | egrep '^http://[a-z0-9]+')
|
|
||||||
if [ -z "$TEST" ]
|
|
||||||
then
|
|
||||||
echo "Host must start with http://"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
locust -f robot-shop.py --host "$HOST" --no-web -c 1 -r 1
|
|
||||||
|
|
Reference in New Issue
Block a user