forked from archiecobbs/s3backer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathauto_testSuite.sh
executable file
·1974 lines (1697 loc) · 75.8 KB
/
auto_testSuite.sh
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
exe_path=$1
config_filepath=$2
if [[ $# -eq 0 ]] ; then
exe_path=./cloudbacker
config_filepath=auto_testConfig
fi
if [[ $# -ne 2 ]] ; then
printf "\n\033[1;34mscript usage : auto_testSuite.sh [exe/path] [config/file/path]\033[0m"
printf "\n\033[1;34mIf no arguments are specified then current directory files will be used with \033[0m"
printf "\n\033[1;34mRunning script ./auto_testSuite.sh $exe_path $config_filepath \033[0m\n"
fi
#check if file path specified is correct
function validate_path()
{
path=$@
if [ -f "$path" ] ; then
echo " "
#printf "\033[1;32mspecified path :: $path. \033[0m\n"
else
printf "\n\033[1;31mERROR :: incorrect path specified : $path not found. \033[0m\n"
exit 1
fi
}
printf "\n\033[1;34m================================================================================== \033[0m\n"
printf "\033[1;34m Test Configuration details \033[0m\n"
printf "\033[1;34m================================================================================== \033[0m\n"
#validate exe path and config file provided as command line arguments
validate_path $exe_path
printf "\033[1;36mExecutable file path - $exe_path \033[0m"
validate_path $config_filepath
printf "\033[1;36mTest configuration file path - $config_filepath \033[0m"
#print date and hostname
printf "\n\033[1;36mDate - $(date) \033[0m\n"
printf "\033[1;36mHostName - $(hostname) \033[0m\n"
#print cloudbacker version
printf "\n\033[1;36m=========================== cloudbacker version ============================= \033[0m\n"
$exe_path --version
printf "\n\033[1;34m=================================================================================\033[0m\n"
printf "\n\033[1;36mStarting script execution\033[0m\n\n"
#This is the function which takes a variable length array as an input.
#Config file has all the command line arguments and flags configured in it.
#Config file is parsed line by line and assigned to below variables.
#below variables will be used as per test case.
function parse_arguments()
{
all_array_values=$1[@]
a=("${!all_array_values}")
accessFile=${a[0]}
accessId=${a[1]}
accessKey=${a[2]}
accesstype=${a[3]}
authVersion=${a[4]}
ec2Role=${a[5]}
baseUrl=${a[6]}
blockCacheFile=${a[7]}
blockCacheMaxDirty=${a[8]}
blockCacheNoVerify=${a[9]}
blockCacheSize=${a[10]}
blockCacheSync=${a[11]}
blockCacheThreads=${a[12]}
blockCacheTimeout=${a[13]}
blockCacheWriteDelay=${a[14]}
blockSize=${a[15]}
cacert=${a[16]}
compression=${a[17]}
directIO=${a[18]}
encrypt=${a[19]}
erase=${a[20]}
fileMode=${a[21]}
filename=${a[22]}
force=${a[23]}
initialRetryPause=${a[24]}
insecure=${a[25]}
keyLength=${a[26]}
listBlocks=${a[27]}
listBlocksAsync=${a[28]}
maxDownloadSpeed=${a[29]}
maxRetryPause=${a[30]}
maxUploadSpeed=${a[31]}
md5CacheSize=${a[32]}
md5CacheTime=${a[33]}
minWriteDelay=${a[34]}
password=${a[35]}
passwordFile=${a[36]}
maxKeys=${a[37]}
prefix=${a[38]}
quiet=${a[39]}
readAhead=${a[40]}
readAheadTrigger=${a[41]}
nameHash=${a[42]}
readOnly=${a[43]}
region=${a[44]}
reset=${a[45]}
storageClass=${a[46]}
filesystem_size=${a[47]}
ssl=${a[48]}
statsFilename=${a[49]}
test_flag=${a[50]}
timeout=${a[51]}
version=${a[52]}
vhost=${a[53]}
bucket=${a[54]}
mountpoint=${a[55]}
localStore=${a[56]}
}
#Here I add all the file contents to the variable - options.
options=$(cat $config_filepath)
#In this step I convert the file contents to an array by splitting on space.
options_array=(${options//' '/ })
#I call the function here to parse options.
parse_arguments options_array
#some arguments need to be tokenized, in order to use in some test cases
arr=( $(echo $localStore | tr '=' ' ') ) # Populate the --localStore=/blk/dev/path tokens into an array
blockDevice=${arr[1]}
arr=( $(echo $filename | tr '=' ' ') ) # Populate the --filename=fileName tokens into an array
mountedfile=${arr[1]}
arr=( $(echo $bucket | tr ':' ' ') ) # Populate the bucket gs://gs-bucket or s3://s3-bucket tokens into an array
btype=${arr[0]}
if [ "$btype" == "s3" ] || [ "$btype" == "S3" ]; then
gs_bucket=0
s3_bucket=1
fi
if [ "$btype" == "gs" ] || [ "$btype" == "GS" ]; then
gs_bucket=1
s3_bucket=0
fi
#function to parse size arguments like size, blockSize etc
parseSize() {(
local SUFFIXES=('' K M G T P E Z Y)
local MULTIPLIER=1
shopt -s nocasematch
for SUFFIX in "${SUFFIXES[@]}"; do
local REGEX="^([0-9]+)(${SUFFIX}i?B?)?\$"
if [[ $1 =~ $REGEX ]]; then
echo $((${BASH_REMATCH[1]} * MULTIPLIER))
#return $((${BASH_REMATCH[1]} * MULTIPLIER))
fi
((MULTIPLIER *= 1024))
done
#echo "$0: invalid size \`$1'" >&2
#return 1
)}
#parse file system size
arr=( $(echo $filesystem_size | tr '=' ' ') ) # Populate the --size=10M tokens into an array
config_size=$(parseSize ${arr[1]})
#echo $config_size
#parse block size
arr=( $(echo $blockSize | tr '=' ' ') ) # Populate the --blockSize=64K tokens into an array
config_blockSize=$(parseSize ${arr[1]})
#echo $config_blockSize
runthis(){
# print the command to the logfile
echo "$@"
# run the command and redirect it's error output to the logfile
eval "$@"
}
#get block device size
bd_size=$(blockdev --getsize64 $blockDevice)
#echo $bd_size
#get block device physical block size
bd_blockSize=$(blockdev --getpbsz $blockDevice)
#echo $bd_blockSize
empty_block_device(){
printf "\n\033[1;34mfree space on block device\033[0m\n"
runthis "dd if=/dev/zero of=$blockDevice bs=$bd_blockSize count=$(($bd_size/$bd_blockSize))"
}
# variables to print summary at the end
total_executed=0
total_failed=0
total_passed=0
#Test bucket name option without any prefix- should not mount and give invalid bucket name error
invalid_bucketName_Test1(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize invalid_bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_bucketName_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_bucketName_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test bucket name option with incorrect prefix - should not mount and give invalid bucket name error
invalid_bucketName_Test2(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize abc://invalid_bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_bucketName_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_bucketName_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test bucket name option with incorrect prefix - should not mount and give invalid bucket name error
invalid_bucketName_Test3(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize 12://invalid_bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_bucketName_Test3 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_bucketName_Test3 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#For GS - Test bucket name option with correct prefix, but bucket does not exist - should not mount
invalid_bucketName_Test4(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize gs://nonExisting_bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_bucketName_Test4 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_bucketName_Test4 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#For s3 - Test bucket name option with correct prefix, but bucket does not exist - should not mount
invalid_bucketName_Test5(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize s3://nonExisting_bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_bucketName_Test5 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_bucketName_Test5 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#For GS - Test bucket name option with correct prefix, empty bucket name - should not mount
invalid_bucketName_Test6(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize gs:// $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_bucketName_Test6 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_bucketName_Test6 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#For s3 - Test bucket name option with correct prefix, empty bucket name - should not mount
invalid_bucketName_Test7(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize s3:// $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_bucketName_Test7 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_bucketName_Test7 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid path to accessFile argument - should not mount
invalid_accessFile_Test1(){
((total_executed++))
runthis "$exe_path --accessFile=/some/dummy/path $filesystem_size $blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_accessFile_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_accessFile_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with empty path to accessFile argument - should not mount
invalid_accessFile_Test2(){
((total_executed++))
runthis "$exe_path --accessFile= $filesystem_size $blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_accessFile_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_accessFile_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid accessId and valid accessKey argument - should not mount
invalid_accessId_Key_Test1(){
((total_executed++))
runthis "$exe_path --accessId=dummyAccessID $accesskey $filesystem_size $blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_accessId_Key_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_accessId_Key_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with valid accessId and invalid accessKey argument - should not mount
invalid_accessId_Key_Test2(){
((total_executed++))
runthis "$exe_path $accessId --accesskey=dummyAccessKey $filesystem_size $blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_accessId_Key_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_accessId_Key_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid accessType argument - should not mount
invalid_accessType_Test1(){
((total_executed++))
runthis "$exe_path $accessFile --accessType=dummy $filesystem_size $blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_accessType_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_accessType_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid authVersion argument - should not mount
invalid_authVersion_Test1(){
((total_executed++))
runthis "$exe_path $accessFile --authVersion=dummy $filesystem_size $blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_authVersion_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_authVersion_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with empty value for authVersion argument - should not mount
invalid_authVersion_Test2(){
((total_executed++))
runthis "$exe_path $accessFile --authVersion= $filesystem_size $blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_authVersion_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_authVersion_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid value for baseURL argument(use http) - should not mount
invalid_baseURL_Test1(){
((total_executed++))
runthis "$exe_path $accessFile --baseURL=http://some-base-url $filesystem_size $blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_baseURL_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_baseURL_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with empty value for baseURL argument - should not mount
invalid_baseURL_Test2(){
((total_executed++))
runthis "$exe_path $accessFile --baseURL= $filesystem_size $blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_baseURL_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_baseURL_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid value for baseURL argument(use https) - should not mount
invalid_baseURL_Test3(){
((total_executed++))
runthis "$exe_path $accessFile --baseURL=https://some-base-url $filesystem_size $blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_baseURL_Test3 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_baseURL_Test3 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid value for baseURL argument(use https) - should not mount
invalid_baseURL_Test4(){
((total_executed++))
runthis "$exe_path $accessFile --baseURL=https://some-base-url/sub-url $filesystem_size $blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_baseURL_Test4 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_baseURL_Test4 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid value for blockSize argument - should not mount
invalid_blockSize_Test1(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size --blockSize=3k $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_blockSize_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_blockSize_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with empty value for blockSize argument - should not mount
invalid_blockSize_Test2(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size --blockSize $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_blockSize_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_blockSize_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid value for fileMode argument - should not mount
invalid_filemode_Test1(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --fileMode=888 $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_filemode_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_filemode_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with empty value for fileMode argument - should not mount
invalid_filemode_Test2(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --fileMode= $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_filemode_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_filemode_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid value for fileMode argument - should not mount
invalid_filemode_Test3(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --fileMode=866 $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_filemode_Test3 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_filemode_Test3 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with empty value for fileName argument - should not mount
invalid_filename_Test1(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --filename= $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_filename_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_filename_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid value for fileName argument - should not mount
invalid_filename_Test2(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --filename=/ $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_filename_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_filename_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with empty value for stats fileName argument - should not mount
invalid_stats_filename_Test1(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --statsFilename= $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_stats_filename_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_stats_filename_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid value for stats fileName argument - should not mount
invalid_stats_filename_Test2(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --statsFilename=/ $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_stats_filename_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_stats_filename_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid value for region argument - should not mount
invalid_region_Test1(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --region=dummy $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_region_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_region_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with empty value for region argument - should not mount
invalid_region_Test2(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --region= $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_region_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_region_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid value for region argument - should not mount
invalid_region_Test3(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --region=us-south $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_region_Test3 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_region_Test3 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with invalid value for storageClass argument - should not mount
invalid_storageClass_Test1(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --storageClass=invalid_class $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_storageClass_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_storageClass_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
unmount_filesystem
}
#Test with empty value for storageClass argument - should not mount
invalid_storageClass_Test2(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --storageClass= $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_storageClass_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_storageClass_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
unmount_filesystem
}
#Test with non default value for storageClass argument - should not mount
invalid_storageClass_Test3(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize --storageClass=DURABLE_REDUCED_AVAILABILITY $bucket $mountpoint"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_storageClass_Test3 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_storageClass_Test3 :: FAIL\033[0m\n\n"
((total_failed++))
fi
unmount_filesystem
}
#Test with non default value for storageClass argument - should not mount
invalid_storageClass_Test4(){
((total_executed++))
if [ $gs_bucket -eq 1]; then
runthis "$exe_path $accessFile $filesystem_size $blockSize --storageClass=REDUCED_REDUNDANCY $bucket $mountpoint"
else
runthis "$exe_path $accessFile $filesystem_size $blockSize --storageClass=DURABLE_REDUCED_AVAILABILITY $bucket $mountpoint"
fi
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_storageClass_Test4 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_storageClass_Test4 :: FAIL\033[0m\n\n"
((total_failed++))
fi
unmount_filesystem
}
#Test with incorrect file system size, not a multiple of 2
invalid_filesize_Test1(){
((total_executed++))
runthis "$exe_path $accessFile --size=$(($config_size+1)) $blockSize $bucket $mountpoint $filename"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_filesize_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_filesize_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with incorrect file system size, multiple of 2, but not multiple of block size
invalid_filesize_Test2(){
((total_executed++))
runthis "$exe_path $accessFile --size=$(($config_size+2)) $blockSize $bucket $mountpoint $filename"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_filesize_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_filesize_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with incorrect block size, not a multiple of 2
invalid_blocksize_Test1(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size --blockSize=$(($config_blockSize+1)) $bucket $mountpoint $filename"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_blocksize_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
printf "\033[1;31m invalid_blocksize_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
}
#Test with mount file system first and then mount with different file system size-metadata handling
invalid_metadata_filesize_Test1(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount with other file system size\033[0m\n"
runthis "$exe_path $accessFile --size=$(($config_size*2)) $blockSize $bucket $mountpoint $filename"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_metadata_filesize_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
unmount_filesystem
printf "\033[1;31m invalid_metadata_filesize_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
else
printf "\033[1;31m invalid_metadata_filesize_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
printf "\033[1;34merase from bucket\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force"
runthis "$exe_path $accessFile --size=$(($config_size*2)) $blockSize $bucket $filename $erase $force"
}
#Test with mount file system first and then mount with different blockSize-metadata handling
invalid_metadata_blockSize_Test1(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount with other block size\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size --blockSize=$(($config_blockSize*2)) $bucket $mountpoint $filename"
if [ $? -ne 0 ]; then
printf "\033[1;32m invalid_metadata_blockSize_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
unmount_filesystem
printf "\033[1;31m invalid_metadata_blockSize_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
else
printf "\033[1;31m invalid_metadata_blockSize_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
printf "\033[1;34merase from bucket\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force"
runthis "$exe_path $accessFile $filesystem_size --blockSize=$(($config_blockSize*2)) $bucket $filename $erase $force"
}
#Test with mount file system first and then mount without blockSize-metadata handling
autoDetect_metadata_blockSize_Test1(){
((total_executed++))
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount without blockSize argument\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $bucket $mountpoint $filename"
if [ $? -ne 0 ]; then
printf "\033[1;31m autoDetect_metadata_blockSize_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
else
unmount_filesystem
printf "\033[1;32m autoDetect_metadata_blockSize_Test1 :: PASS\033[0m\n\n"
((total_passed++))
fi
else
printf "\033[1;31m autoDetect_metadata_blockSize_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
printf "\033[1;34merase from bucket\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force"
}
#Test with mount file system first with nameHash and then mount without nameHash-metadata handling
autoDetect_metadata_nameHash_Test1(){
((total_executed++))
printf "\n\033[1;34mmount with nameHash flag\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --nameHash"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount without nameHash flag\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename"
if [ $? -ne 0 ]; then
printf "\033[1;31m autoDetect_metadata_nameHash_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
else
unmount_filesystem
printf "\033[1;32m autoDetect_metadata_nameHash_Test1 :: PASS\033[0m\n\n"
((total_passed++))
fi
else
printf "\033[1;31m autoDetect_metadata_nameHash_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
printf "\033[1;34merase from bucket\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force --nameHash"
}
#Test with mount file system first without nameHash and then mount with nameHash-metadata handling
autoDetect_metadata_nameHash_Test2(){
((total_executed++))
printf "\n\033[1;34mmount without nameHash flag\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount with nameHash flag\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --nameHash"
if [ $? -ne 0 ]; then
printf "\033[1;32m autoDetect_metadata_nameHash_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
unmount_filesystem
printf "\033[1;31m autoDetect_metadata_nameHash_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
else
printf "\033[1;31m autoDetect_metadata_nameHash_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
printf "\033[1;34merase from bucket\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force"
}
#Test with mount file system first without encryption and then mount with encryption-metadata handling
autoDetect_metadata_encryption_Test1(){
((total_executed++))
printf "\n\033[1;34mmount without encryption flag\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount with encryption flag\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt --compress --password=abcd"
if [ $? -ne 0 ]; then
printf "\033[1;32m autoDetect_metadata_encryption_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
unmount_filesystem
printf "\033[1;31m autoDetect_metadata_encryption_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
else
printf "\033[1;31m autoDetect_metadata_encryption_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
printf "\033[1;34merase from bucket\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force --encrypt --compress --password=abcd"
}
#Test with mount file system first with encryption and then mount without encryption-metadata handling
autoDetect_metadata_encryption_Test2(){
((total_executed++))
printf "\n\033[1;34mmount with encryption flag\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt --compress --password=abcd"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount without encryption flag\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename"
if [ $? -ne 0 ]; then
printf "\033[1;32m autoDetect_metadata_encryption_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
unmount_filesystem
printf "\033[1;31m autoDetect_metadata_encryption_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
else
printf "\033[1;31m autoDetect_metadata_encryption_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
printf "\033[1;34merase from bucket\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force --encrypt --compress --password=abcd"
}
#Test with encryption-metadata handling
autoDetect_metadata_encryption_Test3(){
((total_executed++))
printf "\n\033[1;34mmount with default encryption cipher\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt --compress --password=abcd"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount with other encryption cipher\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt=AES-256-CBC --compress --password=abcd"
if [ $? -ne 0 ]; then
printf "\033[1;32m autoDetect_metadata_encryption_Test3 :: PASS\033[0m\n\n"
((total_passed++))
else
unmount_filesystem
printf "\033[1;31m autoDetect_metadata_encryption_Test3 :: FAIL\033[0m\n\n"
((total_failed++))
fi
else
printf "\033[1;31m autoDetect_metadata_encryption_Test3 :: FAIL\033[0m\n\n"
((total_failed++))
fi
printf "\033[1;34merase from bucket\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force --encrypt --compress --password=abcd"
}
#Test with encryption-metadata handling
autoDetect_metadata_encryption_Test4(){
((total_executed++))
printf "\n\033[1;34mmount with default encryption cipher\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt --compress --password=abcd"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount with other encryption cipher\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt=decrypt --compress --password=abcd"
if [ $? -ne 0 ]; then
printf "\033[1;32m autoDetect_metadata_encryption_Test4 :: PASS\033[0m\n\n"
((total_passed++))
else
unmount_filesystem
printf "\033[1;31m autoDetect_metadata_encryption_Test4 :: FAIL\033[0m\n\n"
((total_failed++))
fi
else
printf "\033[1;31m autoDetect_metadata_encryption_Test4 :: FAIL\033[0m\n\n"
((total_failed++))
fi
printf "\033[1;34merase from bucket\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force --encrypt --compress --password=abcd"
}
#Test with compression-metadata handling
autoDetect_metadata_compress_Test1(){
((total_executed++))
printf "\n\033[1;34mmount with default encryption cipher and compression = 2\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt --compress=2 --password=abcd"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount with default encryption cipher and compression = 1\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt --compress=1 --password=abcd"
if [ $? -ne 0 ]; then
printf "\033[1;32m autoDetect_metadata_compress_Test1 :: PASS\033[0m\n\n"
((total_passed++))
else
unmount_filesystem
printf "\033[1;31m autoDetect_metadata_compress_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
else
printf "\033[1;31m autoDetect_metadata_compress_Test1 :: FAIL\033[0m\n\n"
((total_failed++))
fi
printf "\033[1;34merase from bucket\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force --encrypt --compress=2 --password=abcd"
}
#Test with compression-metadata handling
autoDetect_metadata_compress_Test2(){
((total_executed++))
printf "\n\033[1;34mmount with default encryption cipher and default compression\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt --compress --password=abcd"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount with default encryption cipher and compression = 1\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt --compress=1 --password=abcd"
if [ $? -ne 0 ]; then
printf "\033[1;32m autoDetect_metadata_compress_Test2 :: PASS\033[0m\n\n"
((total_passed++))
else
unmount_filesystem
printf "\033[1;31m autoDetect_metadata_compress_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
else
printf "\033[1;31m autoDetect_metadata_compress_Test2 :: FAIL\033[0m\n\n"
((total_failed++))
fi
printf "\033[1;34merase from bucket\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $filename $erase $force --encrypt --compress --password=abcd"
}
#Test with compression, encryption-metadata handling
autoDetect_metadata_compress_Test3(){
((total_executed++))
printf "\n\033[1;34mmount with encryption cipher=AES-256-CBC and compression=1\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt=AES-256-CBC --compress=1 --password=abcd"
if [ $? -eq 0 ]; then
unmount_filesystem
printf "\n\033[1;34mmount with encryption cipher=AES-128-CBC and compression=1\033[0m\n"
runthis "$exe_path $accessFile $filesystem_size $blockSize $bucket $mountpoint $filename --encrypt=AES-128-CBC --compress=1 --password=abcd"
if [ $? -ne 0 ]; then
printf "\033[1;32m autoDetect_metadata_compress_Test3 :: PASS\033[0m\n\n"
((total_passed++))
else
unmount_filesystem
printf "\033[1;31m autoDetect_metadata_compress_Test3 :: FAIL\033[0m\n\n"
((total_failed++))
fi
else