@@ -898,16 +898,17 @@ func createTestVolumeType(e2eCtx *shared.E2EContext) {
898
898
volumeClient , err := openstack .NewBlockStorageV3 (providerClient , gophercloud.EndpointOpts {Region : clientOpts .RegionName })
899
899
Expect (err ).NotTo (HaveOccurred ())
900
900
901
- shared .Logf ("Creating test volume type" )
902
- _ , err = volumetypes .Create (volumeClient , & volumetypes.CreateOpts {
903
- Name : e2eCtx .E2EConfig .GetVariable (shared .OpenStackVolumeTypeAlt ),
904
- Description : "Test volume type" ,
905
- IsPublic : pointer .Bool (true ),
906
- ExtraSpecs : map [string ]string {},
907
- }).Extract ()
908
- if capoerrors .IsConflict (err ) {
909
- shared .Logf ("Volume type already exists. This may happen in development environments, but it is not expected in CI." )
910
- return
901
+ volumeTypeName := e2eCtx .E2EConfig .GetVariable (shared .OpenStackVolumeTypeAlt )
902
+
903
+ shared .Logf ("Checking if test volume type '%s' exists" , volumeTypeName )
904
+ _ , err = volumetypes .Get (volumeClient , volumeTypeName ).Extract ()
905
+
906
+ if err != nil {
907
+ if capoerrors .IsConflict (err ) {
908
+ shared .Logf ("Volume type already exists. This may happen in development environments, but it is not expected in CI." )
909
+ return
910
+ }
911
+ Expect (err ).NotTo (HaveOccurred ())
911
912
}
912
- Expect ( err ). NotTo ( HaveOccurred () )
913
+ shared . Logf ( "Proceeding with volume type '%s'." , volumeTypeName )
913
914
}
0 commit comments