Skip to content

Commit c67e64c

Browse files
authored
Merge pull request PermanentOrg#16 from OpenTechStrategies/wider-range-test-data
Add instructions for variety testing
2 parents e2debbe + 401e9fc commit c67e64c

File tree

4 files changed

+100
-4
lines changed

4 files changed

+100
-4
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
test-tree/*
22
!test-tree/misc/
3+
test-tree/misc/variety/*
4+
!test-tree/misc/variety/files.zip
35
__pycache__
46
venv
57
log*.txt

README.md

+38-4
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ Run `./upload-test.py test-tree/challenging-names --only=414 --remote-dir=test-4
111111
```
112112
- No duplicates should be be seen on Permanent UI.
113113

114+
### Uploads
114115
#### Large uploads
115-
##### Uploads
116116

117117
To test large file (`400MB` +) uploads, a couple of large files are required. Some ready-made test files can be downloaded via:
118118

@@ -192,14 +192,14 @@ Run
192192
Check the downloads folder in `test-tree/downloads` and ensure that the `downloads/nested` directory has a structure like the nested directory uploaded in the [nested uploads test](#nested-uploads).
193193

194194

195-
#### Quantity Tests
195+
### Quantity Tests
196196

197197
To test uploads/downloads with a large number of files, we definitely need "a large number" of files on either side (local/remote) of the process.
198198

199199
To generate a number of files with a specific size in `test-tree/special-files`, run `./create-files.py --quantity 10 --size 10000 --root-name "10-10B"` (*In this case, the command would generate 10, 10 bytes files.*)
200200

201201
*Take note that in the command `--quantity`, `--size` and `--root-name` are arguments whose values you can change. Quanity for number of files, size for file zie and root name for the name of the parent folder that would hold the files*
202-
##### Large number of uploads
202+
#### Large number of uploads
203203

204204
For 1000, 1B Files:
205205
- Run `./create-files.py`
@@ -223,8 +223,42 @@ For 1000, 5MB Files:
223223

224224
*Of course, by looking at the pattern above, other number-size arrangements can be generated for further testing.*
225225

226+
#### Variety of file types/sizes
226227

227-
##### Large number of downloads
228+
*Prepare data variety*
229+
230+
To test uploads with a variety of file types/sizes, unzip the files archive in `/test-tree/misc/variety/files.zip` into same directory `/test-tree/misc/variety/`
231+
232+
- Unzip : `unzip ./test-tree/misc/variety/files.zip -d ./test-tree/misc/variety`
233+
234+
*Otherwise*
235+
236+
You can add your own files in the range of a few kilo bytes to about 50 mega bytes in the same location (`/test-tree/misc/variety/files`).
237+
238+
Ideally, a few images (`.png`, `.jpg`), document files (`.docx`, `.ppt`, `.xlxs`), video and sound files, and archive files.
239+
240+
241+
*Duplicate data*
242+
243+
Once you have the files in place, you duplicate the files to achieve a desire volume using the duplication script described in the next section.
244+
245+
The `./duplicate-files` script is designed to create multiple copies of files in a specified source directory. It allows you to make 'n' copies of each file found in the source directory and save them in either the same directory or a different destination directory.
246+
247+
Usage: `./duplicate-files <source_path> <n> <destination_path (optional)>`
248+
249+
- Create a duplication by 10 `duplicate-files ./test-tree/misc/variety/files 10`
250+
251+
*You can change the number to reduce or increase the number of files and consequently the resulting size.
252+
253+
254+
##### *Variety upload test*
255+
256+
Now you can test uploads with the variety of files set up in `./test-tree/variety`
257+
258+
- Run `./upload-test.py test-tree/misc/variety/files --remote-dir=variety --log-file=variety.txt --remote=prod --archive-path="/archives/QA (0a21-0000)/My Files/"`
259+
260+
261+
#### Large number of downloads
228262

229263

230264

duplicate-files

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
if [ $# -lt 2 ]; then
4+
echo "Usage: $0 <source_path> <number_of_duplicates> [destination_path]"
5+
exit 1
6+
fi
7+
8+
source_path="$1"
9+
n="$2"
10+
destination_path="$3"
11+
12+
if [ ! -d "$source_path" ]; then
13+
echo "Error: The specified source path does not exist."
14+
exit 1
15+
fi
16+
17+
if [ "$n" -le 0 ]; then
18+
echo "Error: 'n' should be a positive integer."
19+
exit 1
20+
fi
21+
22+
if [ -z "$destination_path" ]; then
23+
destination_path="$source_path"
24+
fi
25+
26+
# Check if the destination path already exists
27+
if [ ! -d "$destination_path" ]; then
28+
echo "Notice: The specified destination path does not exist. Creating it..."
29+
mkdir -p "$destination_path"
30+
fi
31+
32+
# Loop through each file in the specified source path
33+
for file in "$source_path"/*; do
34+
if [ -f "$file" ]; then
35+
filename=$(basename "$file")
36+
37+
# Check if there's an extension
38+
if [[ "$filename" == *.* ]]; then
39+
file_extension="${filename##*.}"
40+
filename_without_extension="${filename%.*}"
41+
else
42+
file_extension=""
43+
filename_without_extension="$filename"
44+
fi
45+
46+
# Create 'n' copies of the file in the destination path
47+
for ((i = 1; i <= n; i++)); do
48+
if [ -z "$file_extension" ]; then
49+
new_filename="${filename} ($i)"
50+
else
51+
new_filename="${filename_without_extension} ($i).$file_extension"
52+
fi
53+
54+
cp "$file" "$destination_path/$new_filename"
55+
echo "Created copy: $destination_path/$new_filename"
56+
done
57+
fi
58+
done
59+
60+
echo "Done."

test-tree/misc/variety/files.zip

78.9 MB
Binary file not shown.

0 commit comments

Comments
 (0)