forked from brianaydemir/pelicanplatform-test-framework
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit-data.sh
More file actions
executable file
·57 lines (38 loc) · 1.76 KB
/
init-data.sh
File metadata and controls
executable file
·57 lines (38 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -eux
rm -rf data/origin data/ads/input
mkdir -p data/origin data/ads/input
set +x
#---------------------------------------------------------------------------
# The intent here is that origin N exports `data/origin/N`. The naming
# scheme for the objects is intended to:
#
# - allow the origins to export the same namespace but different objects
# - avoid a cardinality explosion in Prometheus metrics
echo "Creating objects..."
for x in {0..1}; do
mkdir -p "data/origin/$x/data"
for y in {0..4095}; do echo "$x.$y.$RANDOM" > "data/origin/$x/data/$x.$y"; done
echo "Created $(((x + 1) * 4096))"
done
#---------------------------------------------------------------------------
# Create file transfer plugin ads given the above objects.
echo "Creating transfer ads..."
# Scenario: The namespace is public, and all objects exist.
# shellcheck disable=SC2034
for x in {0..2047}; do y="$RANDOM"; for z in {0..3}; do
echo "[ Url=\"pelican://director:8444/public/data/0.$((RANDOM / 32))\"; LocalFileName=\"/dev/null\" ]" >>"data/ads/input/$x.$y.exist"
done; done
# Scenario: The namespace requires authorization, and all objects exist.
# shellcheck disable=SC2034
for x in {0..2047}; do y="$RANDOM"; for z in {0..1}; do
echo "[ Url=\"pelican://director:8444/private/data/0.$((RANDOM / 64))\"; LocalFileName=\"/dev/null\" ]" >>"data/ads/input/$x.$y.token"
done; done
# Scenario: The namespace is public, but no objects exist.
# shellcheck disable=SC2034
for x in {0..2047}; do y="$RANDOM"; for z in {0..0}; do
echo "[ Url=\"pelican://director:8444/public/data/9.$((RANDOM / 128))\"; LocalFileName=\"/dev/null\" ]" >>"data/ads/input/$x.$y.dne"
done; done
#---------------------------------------------------------------------------
# The end.
echo "Done."