@@ -92,6 +92,7 @@ func TestUpdateObjectEncryptionSuccess(t *testing.T) {
9292 capturedPath = r .URL .Path
9393 capturedQuery = r .URL .Query ()
9494 capturedBody , _ = io .ReadAll (r .Body )
95+ w .Header ().Set ("x-amz-version-id" , "returned-version-id" )
9596 w .WriteHeader (http .StatusOK )
9697 }))
9798 defer ts .Close ()
@@ -116,11 +117,16 @@ func TestUpdateObjectEncryptionSuccess(t *testing.T) {
116117 VersionID : "test-version-id" ,
117118 }
118119
119- err = client .UpdateObjectEncryption (context .Background (), "mybucket" , "myobject" , opts )
120+ result , err : = client .UpdateObjectEncryption (context .Background (), "mybucket" , "myobject" , opts )
120121 if err != nil {
121122 t .Fatalf ("UpdateObjectEncryption failed: %v" , err )
122123 }
123124
125+ // Verify returned version ID from response header.
126+ if result .VersionID != "returned-version-id" {
127+ t .Fatalf ("Expected VersionID 'returned-version-id', got %q" , result .VersionID )
128+ }
129+
124130 // Verify request method.
125131 if capturedMethod != http .MethodPut {
126132 t .Fatalf ("Expected PUT, got %s" , capturedMethod )
@@ -178,7 +184,7 @@ func TestUpdateObjectEncryptionNoVersionID(t *testing.T) {
178184 t .Fatalf ("Failed to create client: %v" , err )
179185 }
180186
181- err = client .UpdateObjectEncryption (context .Background (), "mybucket" , "myobject" , UpdateObjectEncryptionOptions {
187+ _ , err = client .UpdateObjectEncryption (context .Background (), "mybucket" , "myobject" , UpdateObjectEncryptionOptions {
182188 KMSKeyArn : "my-key" ,
183189 })
184190 if err != nil {
@@ -212,7 +218,7 @@ func TestUpdateObjectEncryptionServerError(t *testing.T) {
212218 t .Fatalf ("Failed to create client: %v" , err )
213219 }
214220
215- err = client .UpdateObjectEncryption (context .Background (), "mybucket" , "myobject" , UpdateObjectEncryptionOptions {
221+ _ , err = client .UpdateObjectEncryption (context .Background (), "mybucket" , "myobject" , UpdateObjectEncryptionOptions {
216222 KMSKeyArn : "my-key" ,
217223 })
218224 if err == nil {
@@ -234,7 +240,7 @@ func TestUpdateObjectEncryptionInvalidBucket(t *testing.T) {
234240 t .Fatalf ("Failed to create client: %v" , err )
235241 }
236242
237- err = client .UpdateObjectEncryption (context .Background (), "" , "myobject" , UpdateObjectEncryptionOptions {
243+ _ , err = client .UpdateObjectEncryption (context .Background (), "" , "myobject" , UpdateObjectEncryptionOptions {
238244 KMSKeyArn : "my-key" ,
239245 })
240246 if err == nil {
@@ -251,7 +257,7 @@ func TestUpdateObjectEncryptionInvalidObject(t *testing.T) {
251257 t .Fatalf ("Failed to create client: %v" , err )
252258 }
253259
254- err = client .UpdateObjectEncryption (context .Background (), "mybucket" , "" , UpdateObjectEncryptionOptions {
260+ _ , err = client .UpdateObjectEncryption (context .Background (), "mybucket" , "" , UpdateObjectEncryptionOptions {
255261 KMSKeyArn : "my-key" ,
256262 })
257263 if err == nil {
@@ -268,7 +274,7 @@ func TestUpdateObjectEncryptionEmptyKMSKeyArn(t *testing.T) {
268274 t .Fatalf ("Failed to create client: %v" , err )
269275 }
270276
271- err = client .UpdateObjectEncryption (context .Background (), "mybucket" , "myobject" , UpdateObjectEncryptionOptions {
277+ _ , err = client .UpdateObjectEncryption (context .Background (), "mybucket" , "myobject" , UpdateObjectEncryptionOptions {
272278 KMSKeyArn : "" ,
273279 })
274280 if err == nil {
0 commit comments