@@ -2635,6 +2635,46 @@ def test_version_manifest(self):
2635
2635
versions = [x for x in body .split ('\n ' ) if x ]
2636
2636
self .assertEquals (len (versions ), 1 )
2637
2637
2638
+ # Check for when the versions target container doesn't exist
2639
+ sock = connect_tcp (('localhost' , prolis .getsockname ()[1 ]))
2640
+ fd = sock .makefile ()
2641
+ fd .write ('PUT /v1/a/whoops HTTP/1.1\r \n Host: localhost\r \n '
2642
+ 'Connection: close\r \n X-Storage-Token: t\r \n '
2643
+ 'Content-Length: 0\r \n X-Versions-Location: none\r \n \r \n ' )
2644
+ fd .flush ()
2645
+ headers = readuntil2crlfs (fd )
2646
+ exp = 'HTTP/1.1 201'
2647
+ self .assertEquals (headers [:len (exp )], exp )
2648
+ # Create the versioned file
2649
+ sock = connect_tcp (('localhost' , prolis .getsockname ()[1 ]))
2650
+ fd = sock .makefile ()
2651
+ fd .write ('PUT /v1/a/whoops/foo HTTP/1.1\r \n Host: '
2652
+ 'localhost\r \n Connection: close\r \n X-Storage-Token: '
2653
+ 't\r \n Content-Length: 5\r \n \r \n 00000\r \n ' )
2654
+ fd .flush ()
2655
+ headers = readuntil2crlfs (fd )
2656
+ exp = 'HTTP/1.1 201'
2657
+ self .assertEquals (headers [:len (exp )], exp )
2658
+ # Create another version
2659
+ sock = connect_tcp (('localhost' , prolis .getsockname ()[1 ]))
2660
+ fd = sock .makefile ()
2661
+ fd .write ('PUT /v1/a/whoops/foo HTTP/1.1\r \n Host: '
2662
+ 'localhost\r \n Connection: close\r \n X-Storage-Token: '
2663
+ 't\r \n Content-Length: 5\r \n \r \n 00001\r \n ' )
2664
+ fd .flush ()
2665
+ headers = readuntil2crlfs (fd )
2666
+ exp = 'HTTP/1.1 412'
2667
+ self .assertEquals (headers [:len (exp )], exp )
2668
+ # Delete the object
2669
+ sock = connect_tcp (('localhost' , prolis .getsockname ()[1 ]))
2670
+ fd = sock .makefile ()
2671
+ fd .write ('DELETE /v1/a/whoops/foo HTTP/1.1\r \n Host: '
2672
+ 'localhost\r \n Connection: close\r \n X-Storage-Token: t\r \n \r \n ' )
2673
+ fd .flush ()
2674
+ headers = readuntil2crlfs (fd )
2675
+ exp = 'HTTP/1.1 2' # 2xx response
2676
+ self .assertEquals (headers [:len (exp )], exp )
2677
+
2638
2678
def test_chunked_put_lobjects (self ):
2639
2679
# Create a container for our segmented/manifest object testing
2640
2680
(prolis , acc1lis , acc2lis , con2lis , con2lis , obj1lis , obj2lis ) = \
0 commit comments