initial commit
Change-Id: Ia748646eaf5c18f44eb5b147ff577d0d5ee844e8
This commit is contained in:
16
seed-data/Dockerfile
Normal file
16
seed-data/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM python:3.9-slim
|
||||
|
||||
# add apache bench (ab) tool
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apache2-utils \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /seed
|
||||
|
||||
COPY . .
|
||||
|
||||
# create POST data files with ab friendly formats
|
||||
RUN python make-data.py
|
||||
|
||||
CMD ["/seed/generate-votes.sh"]
|
||||
6
seed-data/generate-votes.sh
Executable file
6
seed-data/generate-votes.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# create 3000 votes (2000 for option a, 1000 for option b)
|
||||
ab -n 1000 -c 50 -p posta -T "application/x-www-form-urlencoded" http://vote/
|
||||
ab -n 1000 -c 50 -p postb -T "application/x-www-form-urlencoded" http://vote/
|
||||
ab -n 1000 -c 50 -p posta -T "application/x-www-form-urlencoded" http://vote/
|
||||
13
seed-data/make-data.py
Normal file
13
seed-data/make-data.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# this creates urlencode-friendly files without EOL
|
||||
import urllib.parse
|
||||
|
||||
outfile = open('postb', 'w')
|
||||
params = ({ 'vote': 'b' })
|
||||
encoded = urllib.parse.urlencode(params)
|
||||
outfile.write(encoded)
|
||||
outfile.close()
|
||||
outfile = open('posta', 'w')
|
||||
params = ({ 'vote': 'a' })
|
||||
encoded = urllib.parse.urlencode(params)
|
||||
outfile.write(encoded)
|
||||
outfile.close()
|
||||
Reference in New Issue
Block a user