Skip to content

Commit 9526f54

Browse files
author
Aries
committed
added dockerfile and add redis pw argument
1 parent d20f10a commit 9526f54

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM python:3.7-slim-stretch
2+
RUN apt-get -y update && apt-get -y install build-essential
3+
RUN apt-get -y install gettext-base
4+
RUN mkdir /redis-load-test
5+
COPY ./Scripts /redis-load-test/Scripts
6+
WORKDIR /redis-load-test/Scripts
7+
RUN pip3 install -r requirments.txt
8+
CMD ["/redis-load-test/Scripts/start.sh"]

Scripts/redis.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

Scripts/redis_get_set.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def load_config(filepath):
2727
configs = load_config(filename)
2828

2929
class RedisClient(object):
30-
def __init__(self, host=configs["redis_host"], port=configs["redis_port"]):
31-
self.rc = redis.StrictRedis(host=host, port=port)
30+
def __init__(self, host=configs["redis_host"], port=configs["redis_port"], password=configs["redis_password"]):
31+
self.rc = redis.StrictRedis(host=host, port=port, password=password)
3232

3333
def query(self, key, command='GET'):
3434
"""Function to Test GET operation on Redis"""

Scripts/redis_orig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"redis_host": "$REDIS_HOST",
3+
"redis_port": "$REDIS_PORT",
4+
"redis_password": "$REDIS_PW"
5+
}

Scripts/start.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /bin/sh
2+
envsubst < redis_orig.json > redis.json
3+
ls -la
4+
cat redis.json
5+
locust -f redis_get_set.py

0 commit comments

Comments
 (0)