Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 55 additions & 54 deletions tests/e2e/config/test_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,60 +106,61 @@ type TestInputData struct {

// This struct has all the testbed related information
type TestBedConfig struct {
EsxIp1 string
EsxIp2 string
EsxIp3 string
EsxIp4 string
EsxIp5 string
EsxIp6 string
EsxIp7 string
EsxIp8 string
EsxIp9 string
EsxIp10 string
VcAddress string
VcAddress2 string
VcAddress3 string
MasterIP1 string
MasterIP2 string
MasterIP3 string
IpPortMap map[string]string
MissingEnvVars []string
DefaultlocalhostIP string //= "127.0.0.1"
VcIp2SshPortNum string
VcIp3SshPortNum string
RwxAccessMode bool
Vcptocsi bool
MultipleSvc bool
WindowsEnv bool
Multivc bool
StretchedSVC bool
IsPrivateNetwork bool
LinkedClone bool
K8sMasterIp1PortNum string
K8sMasterIp2PortNum string
K8sMasterIp3PortNum string
VcIp1SshPortNum string
EsxIp1PortNum string
EsxIp2PortNum string
EsxIp3PortNum string
EsxIp4PortNum string
EsxIp5PortNum string
EsxIp6PortNum string
EsxIp7PortNum string
EsxIp8PortNum string
EsxIp9PortNum string
EsxIp10PortNum string
VcVersion string
DefaultCluster *object.ClusterComputeResource
DefaultDatastore *object.Datastore
Name string `default:"worker"`
User string
Location string
VcIp string
VcVmName string
EsxHosts []map[string]string
Podname string
Datastores []map[string]string
EsxIp1 string
EsxIp2 string
EsxIp3 string
EsxIp4 string
EsxIp5 string
EsxIp6 string
EsxIp7 string
EsxIp8 string
EsxIp9 string
EsxIp10 string
VcAddress string
VcAddress2 string
VcAddress3 string
MasterIP1 string
MasterIP2 string
MasterIP3 string
IpPortMap map[string]string
MissingEnvVars []string
DefaultlocalhostIP string //= "127.0.0.1"
VcIp2SshPortNum string
VcIp3SshPortNum string
RwxAccessMode bool
Vcptocsi bool
MultipleSvc bool
WindowsEnv bool
Multivc bool
StretchedSVC bool
IsPrivateNetwork bool
LinkedClone bool
K8sMasterIp1PortNum string
K8sMasterIp2PortNum string
K8sMasterIp3PortNum string
VcIp1SshPortNum string
EsxIp1PortNum string
EsxIp2PortNum string
EsxIp3PortNum string
EsxIp4PortNum string
EsxIp5PortNum string
EsxIp6PortNum string
EsxIp7PortNum string
EsxIp8PortNum string
EsxIp9PortNum string
EsxIp10PortNum string
VcVersion string
DefaultCluster *object.ClusterComputeResource
DefaultDatastore *object.Datastore
Name string `default:"worker"`
User string
Location string
VcIp string
VcVmName string
EsxHosts []map[string]string
Podname string
Datastores []map[string]string
WcpVsanDirectCluster bool
}

// NetPermissionConfig consists of information used to restrict the
Expand Down
9 changes: 7 additions & 2 deletions tests/e2e/constants/env_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,13 @@ const (
EnvDevopsUserName = "DEVOPS_USERNAME"
)

// For creating disk on target datastore
var (
EnvRestoreStoragePolicy = "RESTORE_STORAGE_POLICY"
)

// For linked clone
var (
EnvStoragePolicy = "STORAGE_POLICY_NAME-LC"
EnvTargetDSUrlForRelocate = "TARGET_DS_URL-LC"
EnvStoragePolicy = "STORAGE_POLICY_NAME_LC"
EnvTargetDSUrlForRelocate = "TARGET_DS_URL_LC"
)
39 changes: 39 additions & 0 deletions tests/e2e/csisnapshot/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,3 +675,42 @@ func GetPersistentVolumeClaimSpecWithDatasource(namespace string, ds string, sto

return claim
}

/*
Create volume snapshot
*/
func CreateVolumeSnapshot(ctx context.Context, e2eTestConfig *config.E2eTestConfig, namespace string, pvclaim *v1.PersistentVolumeClaim, pv []*v1.PersistentVolume, diskSize string) (*snapV1.VolumeSnapshot, *snapV1.VolumeSnapshotContent) {
// Create or get volume snapshot class
ginkgo.By("Get or create volume snapshot class")
snapc := GetSnashotClientSet(e2eTestConfig)
volumeSnapshotClass, err := CreateVolumeSnapshotClass(ctx, e2eTestConfig, snapc, constants.DeletionPolicy)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

// Create volume snapshot
ginkgo.By("Create a volume snapshot")
performCnsQueryVolumeSnapshot := false
if e2eTestConfig.TestInput.ClusterFlavor.SupervisorCluster {
performCnsQueryVolumeSnapshot = true
}
volumeSnapshot, snapshotContent, _,
_, _, _, err := CreateDynamicVolumeSnapshot(ctx, e2eTestConfig, namespace, snapc, volumeSnapshotClass,
pvclaim, pv[0].Spec.CSI.VolumeHandle, diskSize, performCnsQueryVolumeSnapshot)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

return volumeSnapshot, snapshotContent
}

/*
Get snashot client set
*/
func GetSnashotClientSet(e2eTestConfig *config.E2eTestConfig) *snapclient.Clientset {
var restConfig *rest.Config
if e2eTestConfig.TestInput.ClusterFlavor.GuestCluster {
restConfig = GetRestConfigClientForGuestCluster(nil)
} else {
restConfig = vcutil.GetRestConfigClient(e2eTestConfig)
}
snapc, err := snapclient.NewForConfig(restConfig)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
return snapc
}
Loading