Skip to content

Commit

Permalink
Merge pull request #3 from cisco-open/curl_loader
Browse files Browse the repository at this point in the history
  • Loading branch information
svrnm authored Dec 5, 2024
2 parents 54ebc27 + 9ec6278 commit 0037102
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix
31 changes: 31 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#
# Usage ./build.sh repo/user [push]
#
IMAGE_PREFIX="${1:-app-simulator}"

for DIR in nodes/*;
do
if [ -d $DIR ] ; then
echo "Building ${IMAGE_PREFIX}/app-simulator:`basename $DIR`..."
docker build --platform=linux/amd64 -t "${IMAGE_PREFIX}/app-simulator:`basename $DIR`" $DIR;
if [ "$2" == "push" ]; then
echo "Pushing ${IMAGE_PREFIX}/app-simulator:`basename $DIR` to registry ...."
docker push "${IMAGE_PREFIX}/app-simulator:`basename $DIR`"
# Add your commands here
fi
fi
done;

for DIR in loaders/*;
do
if [ -d $DIR ] ; then
echo "Building ${IMAGE_PREFIX}/app-simulator:`basename $DIR`..."
docker build --platform=linux/amd64 -t "${IMAGE_PREFIX}/app-simulator:`basename $DIR`" $DIR;
if [ "$2" == "push" ]; then
echo "Pushing ${IMAGE_PREFIX}/app-simulator:`basename $DIR` to registry ...."
docker push "${IMAGE_PREFIX}/app-simulator:`basename $DIR`"
# Add your commands here
fi
fi
done;
6 changes: 6 additions & 0 deletions loaders/curl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM alpine:3.20.3
RUN apk add --no-cache curl util-linux
WORKDIR /usr/bin/
COPY loader.sh /usr/bin
RUN chmod +x /usr/bin/loader.sh
ENTRYPOINT ["/usr/bin/loader.sh"]
16 changes: 16 additions & 0 deletions loaders/curl/loader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
echo "Running CURL load in ${WAIT} seconds..."
echo "URLs to test"
echo "${URLS}"
echo "Sleep time inbetween requests ${SLEEP}"
sleep ${WAIT}
while [ true ]
do
ID=`uuidgen`
for URL in ${URLS}
do
/usr/bin/curl -s "${URL}?unique_session_id=${ID}"
#/usr/bin/curl -s -X POST -d "unique_session_id=${ID}" "${URL}"
done
sleep ${SLEEP}
done;

0 comments on commit 0037102

Please sign in to comment.