#NEWLINE# @ v2_only ( ) #NEWLINE# def test_initialize_volumes_updated_driver( self ) : #NEWLINE# #INDENT# vol_name = '{0:x}' . format ( random . getrandbits ( 32 ) ) #NEWLINE# full_vol_name = 'composetest_{0}' . format ( vol_name ) #NEWLINE# config_data = config . Config ( version = V2_0 , services = [ { #NEWLINE# #INDENT# 'name' : 'web' , #NEWLINE# 'image' : 'busybox:latest' , #NEWLINE# 'command' : 'top' , #NEWLINE# #UNINDENT# } ] , volumes = { #NEWLINE# #INDENT# vol_name : { #NEWLINE# #INDENT# 'driver' : 'local' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , networks = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# project = Project . from_config ( name = 'composetest' , config_data = config_data , client = self . client ) #NEWLINE# project . volumes . initialize ( ) #NEWLINE# volume_data = self . client . inspect_volume ( volume_data ) #NEWLINE# self . assertEqual ( volume_data [ 'Name' ] , full_vol_name ) #NEWLINE# self . assertEqual ( volume_data [ 'Driver' ] , 'local' ) #NEWLINE# config_data = config_data . _replace ( volumes = { #NEWLINE# #INDENT# vol_name : { #NEWLINE# #INDENT# 'driver' : 'smb' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# project = Project . from_config ( name = 'composetest' , config_data = config_data , client = self . client ) #NEWLINE# with self . assertRaises ( config . ConfigurationError ) as e : #NEWLINE# #INDENT# project . volumes . initialize ( ) #NEWLINE# #UNINDENT# assert ( 'Configuration for volume {0} specifies driver smb' . format ( vol_name ) in str ( e . exception ) )