Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable container images for cert-csi #53

Merged
merged 5 commits into from
Dec 4, 2023
Merged
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
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 @@
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 @@
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 @@
VolumeSize: minSize,
ChainNumber: 2,
ChainLength: 2,
Image: testImage,
})

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

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

Check failure on line 242 in pkg/cmd/certifycmd.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
}

if sc.Expansion {
Expand All @@ -239,6 +250,7 @@
PodNumber: 1,
InitialSize: minSize,
ExpandedSize: expSize.String(),
Image: testImage,
})

if sc.RawBlock {
Expand All @@ -248,6 +260,7 @@
IsBlock: true,
InitialSize: minSize,
ExpandedSize: expSize.String(),
Image: testImage,
})
}
}
Expand All @@ -261,13 +274,15 @@
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 @@
RawBlock: true,
AccessMode: "ReadWriteMany",
VolumeSize: minSize,
Image: testImage,
})
}

Expand All @@ -286,6 +302,7 @@
RawBlock: false,
AccessMode: "ReadWriteMany",
VolumeSize: minSize,
Image: testImage,
})
}

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

Expand All @@ -304,6 +322,7 @@
RawBlock: false,
AccessMode: "ReadWriteOncePod",
VolumeSize: minSize,
Image: testImage,
})
}

Expand All @@ -313,6 +332,7 @@
FSType: sc.Ephemeral.FSType,
PodNumber: 2,
VolumeAttributes: sc.Ephemeral.VolumeAttributes,
Image: testImage,
})
}
if sc.VGS {
Expand Down Expand Up @@ -341,6 +361,7 @@
VolumeNumber: 2,
Driver: driverName,
VolumeGroupName: vgsName,
Image: testImage,
})
}
if sc.CapacityTracking != nil {
Expand All @@ -349,6 +370,7 @@
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 @@
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 @@ -127,13 +131,13 @@
logDir := "logs"
path := logDir + "/" + description + ".txt"
if _, err := os.Stat(logDir); os.IsNotExist(err) {
createErr := os.Mkdir(logDir, 0750)

Check failure on line 134 in pkg/cmd/functionalcmd.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
if createErr != nil {
log.Errorf("Error creating log directory")
}
}
// enable logging for each suite in a separate file.
logFile, err := os.OpenFile(filepath.Clean(path), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600)

Check failure on line 140 in pkg/cmd/functionalcmd.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
if err != nil {
log.Errorf("Error creating log file:%s", err)
}
Expand Down Expand Up @@ -421,6 +425,10 @@
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 @@
CustomPvcName: pvcName,
CustomPodName: podName,
AccessMode: accessMode,
Image: testImage,
},
}

Expand Down Expand Up @@ -488,6 +497,10 @@
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 @@
RawBlock: blockVol,
VolAccessMode: volAccessMode,
ROFlag: roFlag,
Image: testImage,
},
}

Expand Down Expand Up @@ -557,6 +571,10 @@
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 @@
CustomSnapName: snapName,
AccessModeOriginal: accessModeOriginal,
AccessModeRestored: accessModeRestored,
Image: testImage,
},
}

Expand Down Expand Up @@ -611,13 +630,17 @@
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 @@
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 @@
VolumeAttributes: volAttributes,
Description: desc,
PodCustomName: podName,
Image: testImage,
},
}

Expand Down Expand Up @@ -850,12 +877,17 @@
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
Loading