@@ -23,34 +23,59 @@ source ./tests/util/util_setup.sh
23
23
24
24
test_file=" test_file"
25
25
26
- @test " REST - HeadObject returns x-amz-checksum-sha256" {
26
+ @test " REST - invalid checksum type" {
27
+ if [ " $DIRECT " != " true" ]; then
28
+ skip " https://github.com/versity/versitygw/issues/1104"
29
+ fi
27
30
run setup_bucket_and_file " $BUCKET_ONE_NAME " " $test_file "
28
31
assert_success
29
32
30
- run put_object_rest_checksum " $TEST_FILE_FOLDER /$test_file " " $BUCKET_ONE_NAME " " $test_file " " sha256 "
33
+ run check_invalid_checksum_type " $TEST_FILE_FOLDER /$test_file " " $BUCKET_ONE_NAME " " $test_file "
31
34
assert_success
35
+ }
32
36
33
- run check_checksum_rest_sha256 " $BUCKET_ONE_NAME " " $test_file " " $TEST_FILE_FOLDER /$test_file "
37
+ @test " REST - sha256 checksum - invalid" {
38
+ run check_checksum_rest_invalid " sha256"
34
39
assert_success
35
40
}
36
41
37
- @test " REST - PutObject rejects invalid sha256 checksum" {
38
- run setup_bucket_and_file " $BUCKET_ONE_NAME " " $test_file "
42
+ @test " REST - sha256 checksum - incorrect " {
43
+ run check_checksum_rest_incorrect " sha256 "
39
44
assert_success
45
+ }
40
46
41
- run put_object_rest_sha256_invalid " $TEST_FILE_FOLDER /$test_file " " $BUCKET_ONE_NAME " " $test_file "
47
+ @test " REST - sha256 checksum - correct" {
48
+ run add_correct_checksum " sha256"
42
49
assert_success
43
50
}
44
51
45
- @test " REST - PutObject rejects incorrect sha256 checksum" {
52
+ @test " REST - HeadObject returns x-amz- checksum-sha256 " {
46
53
run setup_bucket_and_file " $BUCKET_ONE_NAME " " $test_file "
47
54
assert_success
48
55
49
- run put_object_rest_sha256_incorrect " $TEST_FILE_FOLDER /$test_file " " $BUCKET_ONE_NAME " " $test_file "
56
+ run put_object_rest_checksum " $TEST_FILE_FOLDER /$test_file " " $BUCKET_ONE_NAME " " $test_file " " sha256"
57
+ assert_success
58
+
59
+ run check_checksum_rest_sha256 " $BUCKET_ONE_NAME " " $test_file " " $TEST_FILE_FOLDER /$test_file "
60
+ assert_success
61
+ }
62
+
63
+ @test " REST - crc32 checksum - invalid" {
64
+ run check_checksum_rest_invalid " crc32c"
65
+ assert_success
66
+ }
67
+
68
+ @test " REST - crc32 checksum - incorrect" {
69
+ run check_checksum_rest_incorrect " crc32"
50
70
assert_success
51
71
}
52
72
53
73
@test " REST - crc32 checksum - correct" {
74
+ run add_correct_checksum " crc32"
75
+ assert_success
76
+ }
77
+
78
+ @test " REST - crc32 checksum - HeadObject" {
54
79
run setup_bucket_and_file " $BUCKET_ONE_NAME " " $test_file "
55
80
assert_success
56
81
@@ -61,26 +86,58 @@ test_file="test_file"
61
86
assert_success
62
87
}
63
88
64
- @test " REST - crc32 checksum - incorrect " {
65
- run setup_bucket_and_file " $BUCKET_ONE_NAME " " $test_file "
89
+ @test " REST - crc64nvme checksum - invalid " {
90
+ run check_checksum_rest_invalid " crc64nvme "
66
91
assert_success
92
+ }
67
93
68
- run put_object_rest_crc32_incorrect " $TEST_FILE_FOLDER /$test_file " " $BUCKET_ONE_NAME " " $test_file "
94
+ @test " REST - crc64nvme checksum - incorrect" {
95
+ run check_checksum_rest_incorrect " crc64nvme"
69
96
assert_success
70
97
}
71
98
72
99
@test " REST - crc64nvme checksum - correct" {
73
- run setup_bucket_and_file " $BUCKET_ONE_NAME " " $test_file "
100
+ run add_correct_checksum " sha256 "
74
101
assert_success
102
+ }
75
103
76
- run put_object_rest_checksum " $TEST_FILE_FOLDER /$test_file " " $BUCKET_ONE_NAME " " $test_file " " crc64nvme"
104
+ @test " REST - crc32c checksum - invalid" {
105
+ run check_checksum_rest_invalid " crc32c"
77
106
assert_success
78
107
}
79
108
80
- @test " REST - crc64nvme checksum - incorrect" {
109
+ @test " REST - crc32c checksum - incorrect" {
110
+ run check_checksum_rest_incorrect " crc32c"
111
+ assert_success
112
+ }
113
+
114
+ @test " REST - crc32c checksum - correct" {
115
+ run add_correct_checksum " crc32c"
116
+ assert_success
117
+ }
118
+
119
+ @test " REST - sha1 checksum - invalid" {
120
+ run check_checksum_rest_invalid " sha1"
121
+ assert_success
122
+ }
123
+
124
+ @test " REST - sha1 checksum - incorrect" {
125
+ run check_checksum_rest_incorrect " sha1"
126
+ assert_success
127
+ }
128
+
129
+ @test " REST - sha1 checksum - correct" {
130
+ run add_correct_checksum " sha1"
131
+ assert_success
132
+ }
133
+
134
+ @test " REST - attempt to get checksum without checksum mode" {
81
135
run setup_bucket_and_file " $BUCKET_ONE_NAME " " $test_file "
82
136
assert_success
83
137
84
- run put_object_rest_crc64nvme_incorrect " $TEST_FILE_FOLDER /$test_file " " $BUCKET_ONE_NAME " " $test_file "
138
+ run add_correct_checksum " sha256"
139
+ assert_success
140
+
141
+ run head_object_without_and_with_checksum " $BUCKET_ONE_NAME " " $test_file "
85
142
assert_success
86
143
}
0 commit comments