Skip to content

Commit c768791

Browse files
committed
add create scripts
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
1 parent 521a60c commit c768791

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

scripts/create-files.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
CLIENTS=${CLIENTS:-2}
3+
COUNT=${COUNT:-100}
4+
OCIS_URL=${OCIS_URL:-https://localhost:9200}
5+
ENDPOINT=${ENDPOINT:-/webdav}
6+
FOLDER=${FOLDER:-c$CLIENTS x i$COUNT files}
7+
USER=${USER:-einstein}
8+
PASSWORD=${PASSWORD:-relativity}
9+
CURL_OPTS=${CURL_OPTS:--k}
10+
11+
curl -X MKCOL "$OCIS_URL$ENDPOINT/$FOLDER/" -u $USER:$PASSWORD $CURL_OPTS || { echo "could not create collection '$OCIS_URL$ENDPOINT/$FOLDER/'" >&2; exit 1; }
12+
for c in $(seq 1 $CLIENTS);
13+
do
14+
{
15+
for i in $(seq 1 $COUNT);
16+
do
17+
curl -X PUT -d "$c,$i" "$OCIS_URL$ENDPOINT/$FOLDER/file c$c i$i.txt" -u $USER:$PASSWORD $CURL_OPTS
18+
done
19+
} &
20+
done

scripts/create-tree.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
DEPTH=${DEPTH:-3}
3+
WIDTH=${WIDTH:-10}
4+
OCIS_URL=${OCIS_URL:-https://localhost:9200}
5+
ENDPOINT=${ENDPOINT:-/webdav}
6+
FOLDER=${FOLDER:-w$WIDTH x d$DEPTH folders}
7+
USER=${USER:-einstein}
8+
PASSWORD=${PASSWORD:-relativity}
9+
CURL_OPTS=${CURL_OPTS:--k}
10+
11+
COUNT=0
12+
MAX=0
13+
14+
calc_max()
15+
{
16+
for i in $(seq 1 $2);
17+
do {
18+
MAX=$(( MAX + ($1 ** i) ))
19+
}
20+
done
21+
}
22+
23+
calc_max $WIDTH $DEPTH
24+
25+
create_tree()
26+
{
27+
if (( $2 >= 1 )); then
28+
# first create w dirs
29+
for w in $(seq 1 $1);
30+
do {
31+
p="$3/w${w}d$2"
32+
COUNT=$(( COUNT + 1 ))
33+
echo "creating $COUNT/$MAX $OCIS_URL$ENDPOINT/$FOLDER$p"
34+
curl -X MKCOL "$OCIS_URL$ENDPOINT/$FOLDER$p" -u $USER:$PASSWORD -w "%{http_code}" $CURL_OPTS || { echo "could not create collection '$OCIS_URL$ENDPOINT/$FOLDER$p'" >&2; exit 1; } &
35+
create_tree $1 $(( $2 - 1 )) $p
36+
}
37+
done
38+
fi
39+
}
40+
41+
# creating 20/20 https://cloud.ocis.test/webdav/w20 x d1 folders/w20d1
42+
# creating 420/400 https://cloud.ocis.test/webdav/w20 x d2 folders/w20d2/w20d1
43+
# creating 8420/8000 https://cloud.ocis.test/webdav/w20 x d3 folders/w20d3/w20d2/w20d1
44+
45+
# creating 10/10 https://cloud.ocis.test/webdav/w10 x d1 folders/w10d1
46+
# creating 110/100 https://cloud.ocis.test/webdav/w10 x d2 folders/w10d2/w10d1
47+
# creating 1110/1000 https://cloud.ocis.test/webdav/w10 x d3 folders/w10d3/w10d2/w10d1
48+
#creating 11110/10000 https://cloud.ocis.test/webdav/w10 x d4 folders/w10d4/w10d3/w10d2/w10d1
49+
50+
# w^d +
51+
52+
curl -X MKCOL "$OCIS_URL$ENDPOINT/$FOLDER" -u $USER:$PASSWORD -w "%{http_code}" $CURL_OPTS || { echo "could not create collection '$OCIS_URL$ENDPOINT/$FOLDER/'" >&2; exit 1; }
53+
54+
create_tree $WIDTH $DEPTH

0 commit comments

Comments
 (0)