Skip to content

Commit

Permalink
Merge pull request #53 from dell/feature/configurable-images
Browse files Browse the repository at this point in the history
Configurable container images for cert-csi
  • Loading branch information
suryagupta4 authored Dec 4, 2023
2 parents 5c89db5 + 9b50afb commit c79ca4e
Show file tree
Hide file tree
Showing 7 changed files with 317 additions and 51 deletions.
22 changes: 22 additions & 0 deletions pkg/cmd/certifycmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ func GetCertifyCommand() cli.Command {
Usage: "path to certification config file",
Required: true,
},
cli.StringFlag{
Name: "image-config",
Usage: "path to images config file",
},
cli.StringFlag{
Name: "config, conf, c",
Usage: "config for connecting to kubernetes",
Expand Down Expand Up @@ -181,6 +185,10 @@ func GetCertifyCommand() cli.Command {
return fmt.Errorf("unable to decode Config: %s", err)
}

testImage, err := getTestImage(c.String("image-config"))
if err != nil {
return fmt.Errorf("failed to get test image: %s", err)
}
// Parse timeout
timeout, err := time.ParseDuration(c.String("timeout"))
if err != nil {
Expand Down Expand Up @@ -212,6 +220,7 @@ func GetCertifyCommand() cli.Command {
VolumeSize: minSize,
ChainNumber: 2,
ChainLength: 2,
Image: testImage,
})

s = append(s, &suites.ScalingSuite{
Expand All @@ -220,13 +229,15 @@ func GetCertifyCommand() cli.Command {
GradualScaleDown: false,
PodPolicy: "Parallel",
VolumeSize: minSize,
Image: testImage,
})

if sc.Clone {
s = append(s, &suites.CloneVolumeSuite{
VolumeNumber: 1,
PodNumber: 2,
VolumeSize: minSize,
Image: testImage,
})

}
Expand All @@ -239,6 +250,7 @@ func GetCertifyCommand() cli.Command {
PodNumber: 1,
InitialSize: minSize,
ExpandedSize: expSize.String(),
Image: testImage,
})

if sc.RawBlock {
Expand All @@ -248,6 +260,7 @@ func GetCertifyCommand() cli.Command {
IsBlock: true,
InitialSize: minSize,
ExpandedSize: expSize.String(),
Image: testImage,
})
}
}
Expand All @@ -261,13 +274,15 @@ func GetCertifyCommand() cli.Command {
SnapAmount: 3,
SnapClass: snapClass,
VolumeSize: minSize,
Image: testImage,
})

s = append(s, &suites.ReplicationSuite{
VolumeNumber: 5,
VolumeSize: minSize,
PodNumber: 2,
SnapClass: snapClass,
Image: testImage,
})
}

Expand All @@ -277,6 +292,7 @@ func GetCertifyCommand() cli.Command {
RawBlock: true,
AccessMode: "ReadWriteMany",
VolumeSize: minSize,
Image: testImage,
})
}

Expand All @@ -286,6 +302,7 @@ func GetCertifyCommand() cli.Command {
RawBlock: false,
AccessMode: "ReadWriteMany",
VolumeSize: minSize,
Image: testImage,
})
}

Expand All @@ -295,6 +312,7 @@ func GetCertifyCommand() cli.Command {
VolumeNumber: 1,
VolumeSize: minSize,
Namespace: c.String("driver-namespace"),
Image: testImage,
})
}

Expand All @@ -304,6 +322,7 @@ func GetCertifyCommand() cli.Command {
RawBlock: false,
AccessMode: "ReadWriteOncePod",
VolumeSize: minSize,
Image: testImage,
})
}

Expand All @@ -313,6 +332,7 @@ func GetCertifyCommand() cli.Command {
FSType: sc.Ephemeral.FSType,
PodNumber: 2,
VolumeAttributes: sc.Ephemeral.VolumeAttributes,
Image: testImage,
})
}
if sc.VGS {
Expand Down Expand Up @@ -341,6 +361,7 @@ func GetCertifyCommand() cli.Command {
VolumeNumber: 2,
Driver: driverName,
VolumeGroupName: vgsName,
Image: testImage,
})
}
if sc.CapacityTracking != nil {
Expand All @@ -349,6 +370,7 @@ func GetCertifyCommand() cli.Command {
StorageClass: sc.Name,
VolumeSize: minSize,
PollInterval: sc.CapacityTracking.PollInterval,
Image: testImage,
})
}
log.Infof("Suites to run with %s storage class:", color.CyanString(sc.Name))
Expand Down
36 changes: 34 additions & 2 deletions pkg/cmd/functionalcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func GetFunctionalTestCommand() cli.Command {
Name: "description, de",
Usage: "To provide test case description",
},
cli.StringFlag{
Name: "image-config",
Usage: "path to images config file",
},
}

listCmd := cli.Command{
Expand Down Expand Up @@ -421,6 +425,10 @@ func getFunctionalCloneVolumeCommand(globalFlags []cli.Flag) cli.Command {
pvcName := c.String("pvc-name")
podName := c.String("pod-name")
accessMode := c.String("access-mode")
testImage, err := getTestImage(c.String("image-config"))
if err != nil {
return fmt.Errorf("failed to get test image: %s", err)
}

s := []suites.Interface{
&suites.CloneVolumeSuite{
Expand All @@ -430,6 +438,7 @@ func getFunctionalCloneVolumeCommand(globalFlags []cli.Flag) cli.Command {
CustomPvcName: pvcName,
CustomPodName: podName,
AccessMode: accessMode,
Image: testImage,
},
}

Expand Down Expand Up @@ -488,6 +497,10 @@ func getFunctionalProvisioningCommand(globalFlags []cli.Flag) cli.Command {
desc := c.String("description")
volAccessMode := c.String("vol-access-mode")
roFlag := c.Bool("roFlag")
testImage, err := getTestImage(c.String("image-config"))
if err != nil {
return fmt.Errorf("failed to get test image: %s", err)
}
s := []suites.Interface{
&suites.ProvisioningSuite{
VolumeNumber: volNum,
Expand All @@ -497,6 +510,7 @@ func getFunctionalProvisioningCommand(globalFlags []cli.Flag) cli.Command {
RawBlock: blockVol,
VolAccessMode: volAccessMode,
ROFlag: roFlag,
Image: testImage,
},
}

Expand Down Expand Up @@ -557,6 +571,10 @@ func getFunctionalSnapCreationCommand(globalFlags []cli.Flag) cli.Command {
desc := c.String("description")
snapName := c.String("snap-name")
accessModeRestored := c.String("access-mode-restored-volume")
testImage, err := getTestImage(c.String("image-config"))
if err != nil {
return fmt.Errorf("failed to get test image: %s", err)
}
s := []suites.Interface{
&suites.SnapSuite{
SnapClass: snapClass,
Expand All @@ -566,6 +584,7 @@ func getFunctionalSnapCreationCommand(globalFlags []cli.Flag) cli.Command {
CustomSnapName: snapName,
AccessModeOriginal: accessModeOriginal,
AccessModeRestored: accessModeRestored,
Image: testImage,
},
}

Expand Down Expand Up @@ -611,13 +630,17 @@ func getFunctionalMultiAttachVolCommand(globalFlags []cli.Flag) cli.Command {
desc := c.String("description")
isRawBlock := c.Bool("block")
accessMode := c.String("access-mode")

testImage, err := getTestImage(c.String("image-config"))
if err != nil {
return fmt.Errorf("failed to get test image: %s", err)
}
s := []suites.Interface{
&suites.MultiAttachSuite{
PodNumber: pods,
RawBlock: isRawBlock,
Description: desc,
AccessMode: accessMode,
Image: testImage,
},
}

Expand Down Expand Up @@ -669,7 +692,10 @@ func getFunctionalEphemeralCreationCommand(globalFlags []cli.Flag) cli.Command {
fsType := c.String("fs-type")
attributesFile := c.String("csi-attributes")
podName := c.String("pod-name")

testImage, err := getTestImage(c.String("image-config"))
if err != nil {
return fmt.Errorf("failed to get test image: %s", err)
}
// We will generate volumeAttributes by reading the properties file
volAttributes, err := readEphemeralConfig(attributesFile)
if err != nil {
Expand All @@ -685,6 +711,7 @@ func getFunctionalEphemeralCreationCommand(globalFlags []cli.Flag) cli.Command {
VolumeAttributes: volAttributes,
Description: desc,
PodCustomName: podName,
Image: testImage,
},
}

Expand Down Expand Up @@ -850,12 +877,17 @@ func getCapacityTrackingCommand(globalFlags []cli.Flag) cli.Command {
storageClass := c.String("sc")
volumeSize := c.String("volSize")
pollInterval := c.Duration("poll-interval")
testImage, err := getTestImage(c.String("image-config"))
if err != nil {
return fmt.Errorf("failed to get test image: %s", err)
}
s := []suites.Interface{
&suites.CapacityTrackingSuite{
DriverNamespace: driverns,
StorageClass: storageClass,
VolumeSize: volumeSize,
PollInterval: pollInterval,
Image: testImage,
},
}

Expand Down
Loading

0 comments on commit c79ca4e

Please sign in to comment.