@@ -49,16 +49,15 @@ import (
49
49
utilrand "k8s.io/apimachinery/pkg/util/rand"
50
50
"k8s.io/apimachinery/pkg/util/sets"
51
51
"k8s.io/utils/pointer"
52
+ infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
53
+ capoerrors "sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/errors"
54
+ "sigs.k8s.io/cluster-api-provider-openstack/test/e2e/shared"
52
55
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
53
56
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
54
57
"sigs.k8s.io/cluster-api/controllers/noderefutil"
55
58
"sigs.k8s.io/cluster-api/test/framework"
56
59
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
57
60
crclient "sigs.k8s.io/controller-runtime/pkg/client"
58
-
59
- infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
60
- capoerrors "sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/errors"
61
- "sigs.k8s.io/cluster-api-provider-openstack/test/e2e/shared"
62
61
)
63
62
64
63
const specName = "e2e"
@@ -898,16 +897,17 @@ func createTestVolumeType(e2eCtx *shared.E2EContext) {
898
897
volumeClient , err := openstack .NewBlockStorageV3 (providerClient , gophercloud.EndpointOpts {Region : clientOpts .RegionName })
899
898
Expect (err ).NotTo (HaveOccurred ())
900
899
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
900
+ volumeTypeName := e2eCtx .E2EConfig .GetVariable (shared .OpenStackVolumeTypeAlt )
901
+
902
+ shared .Logf ("Checking if test volume type '%s' exists" , volumeTypeName )
903
+ _ , err = volumetypes .Get (volumeClient , volumeTypeName ).Extract ()
904
+
905
+ if err != nil {
906
+ if capoerrors .IsConflict (err ) {
907
+ shared .Logf ("Volume type already exists. This may happen in development environments, but it is not expected in CI." )
908
+ return
909
+ }
910
+ Expect (err ).NotTo (HaveOccurred ())
911
911
}
912
- Expect ( err ). NotTo ( HaveOccurred () )
912
+ shared . Logf ( "Proceeding with volume type '%s'." , volumeTypeName )
913
913
}
0 commit comments