mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-22 21:10:22 +00:00
e2e: reformat error message with consistent formatting
To make the error return consistent across e2e tests we have decided to remove with error presence from the logs and this commit does that for e2e/upgrade-cephfs.go. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
5ee723e634
commit
fc7d3fadf5
@ -46,7 +46,7 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
if cephCSINamespace != defaultNs {
|
||||
err = createNamespace(c, cephCSINamespace)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create namespace with error %v", err)
|
||||
e2elog.Failf("failed to create namespace: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,43 +54,43 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
// when we are done upgrading.
|
||||
cwd, err = os.Getwd()
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to getwd with error %v", err)
|
||||
e2elog.Failf("failed to getwd: %v", err)
|
||||
}
|
||||
err = upgradeAndDeployCSI(upgradeVersion, "cephfs")
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to upgrade csi with error %v", err)
|
||||
e2elog.Failf("failed to upgrade csi: %v", err)
|
||||
}
|
||||
err = createConfigMap(cephFSDirPath, f.ClientSet, f)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create configmap with error %v", err)
|
||||
e2elog.Failf("failed to create configmap: %v", err)
|
||||
}
|
||||
var key string
|
||||
// create cephFS provisioner secret
|
||||
key, err = createCephUser(f, keyringCephFSProvisionerUsername, cephFSProvisionerCaps())
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create user %s with error %v", keyringCephFSProvisionerUsername, err)
|
||||
e2elog.Failf("failed to create user %s: %v", keyringCephFSProvisionerUsername, err)
|
||||
}
|
||||
err = createCephfsSecret(f, cephFSProvisionerSecretName, keyringCephFSProvisionerUsername, key)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create provisioner secret with error %v", err)
|
||||
e2elog.Failf("failed to create provisioner secret: %v", err)
|
||||
}
|
||||
// create cephFS plugin secret
|
||||
key, err = createCephUser(f, keyringCephFSNodePluginUsername, cephFSNodePluginCaps())
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create user %s with error %v", keyringCephFSNodePluginUsername, err)
|
||||
e2elog.Failf("failed to create user %s: %v", keyringCephFSNodePluginUsername, err)
|
||||
}
|
||||
err = createCephfsSecret(f, cephFSNodePluginSecretName, keyringCephFSNodePluginUsername, key)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create node secret with error %v", err)
|
||||
e2elog.Failf("failed to create node secret: %v", err)
|
||||
}
|
||||
|
||||
err = createCephFSSnapshotClass(f)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create snapshotclass with error %v", err)
|
||||
e2elog.Failf("failed to create snapshotclass: %v", err)
|
||||
}
|
||||
err = createCephfsStorageClass(f.ClientSet, f, true, nil)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create storageclass with error %v", err)
|
||||
e2elog.Failf("failed to create storageclass: %v", err)
|
||||
}
|
||||
})
|
||||
AfterEach(func() {
|
||||
@ -110,27 +110,27 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
}
|
||||
err = deleteConfigMap(cephFSDirPath)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete configmap with error %v", err)
|
||||
e2elog.Failf("failed to delete configmap: %v", err)
|
||||
}
|
||||
err = c.CoreV1().
|
||||
Secrets(cephCSINamespace).
|
||||
Delete(context.TODO(), cephFSProvisionerSecretName, metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete provisioner secret with error %v", err)
|
||||
e2elog.Failf("failed to delete provisioner secret: %v", err)
|
||||
}
|
||||
err = c.CoreV1().
|
||||
Secrets(cephCSINamespace).
|
||||
Delete(context.TODO(), cephFSNodePluginSecretName, metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete node secret with error %v", err)
|
||||
e2elog.Failf("failed to delete node secret: %v", err)
|
||||
}
|
||||
err = deleteResource(cephFSExamplePath + "storageclass.yaml")
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete storageclass with error %v", err)
|
||||
e2elog.Failf("failed to delete storageclass: %v", err)
|
||||
}
|
||||
err = deleteResource(cephFSExamplePath + "snapshotclass.yaml")
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete storageclass with error %v", err)
|
||||
e2elog.Failf("failed to delete storageclass: %v", err)
|
||||
}
|
||||
if deployCephFS {
|
||||
deleteCephfsPlugin()
|
||||
@ -138,7 +138,7 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
err = deleteNamespace(c, cephCSINamespace)
|
||||
if err != nil {
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete namespace with error %v", err)
|
||||
e2elog.Failf("failed to delete namespace: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -150,13 +150,13 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
By("checking provisioner deployment is running", func() {
|
||||
err = waitForDeploymentComplete(cephFSDeploymentName, cephCSINamespace, f.ClientSet, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("timeout waiting for deployment %s with error %v", cephFSDeploymentName, err)
|
||||
e2elog.Failf("timeout waiting for deployment %s: %v", cephFSDeploymentName, err)
|
||||
}
|
||||
})
|
||||
By("checking nodeplugin deamonset pods are running", func() {
|
||||
err = waitForDaemonSets(cephFSDeamonSetName, cephCSINamespace, f.ClientSet, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("timeout waiting for daemonset %s with error%v", cephFSDeamonSetName, err)
|
||||
e2elog.Failf("timeout waiting for daemonset %s: %v", cephFSDeamonSetName, err)
|
||||
}
|
||||
})
|
||||
|
||||
@ -169,13 +169,13 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
|
||||
pvc, err = loadPVC(pvcPath)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to load pvc with error %v", err)
|
||||
e2elog.Failf("failed to load pvc: %v", err)
|
||||
}
|
||||
pvc.Namespace = f.UniqueName
|
||||
|
||||
app, err = loadApp(appPath)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to load application with error %v", err)
|
||||
e2elog.Failf("failed to load application: %v", err)
|
||||
}
|
||||
label[appKey] = appLabel
|
||||
app.Namespace = f.UniqueName
|
||||
@ -184,7 +184,7 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
pvc.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(pvcSize)
|
||||
err = createPVCAndApp("", f, pvc, app, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create pvc and application with error %v", err)
|
||||
e2elog.Failf("failed to create pvc and application: %v", err)
|
||||
}
|
||||
opt := metav1.ListOptions{
|
||||
LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]),
|
||||
@ -212,7 +212,7 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
e2elog.Logf("Calculating checksum of %s", filePath)
|
||||
checkSum, err = calculateSHA512sum(f, app, filePath, &opt)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to calculate checksum with error %v", err)
|
||||
e2elog.Failf("failed to calculate checksum: %v", err)
|
||||
}
|
||||
|
||||
// pvc clone is only supported from v1.16+
|
||||
@ -230,25 +230,25 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
}
|
||||
err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete application with error %v", err)
|
||||
e2elog.Failf("failed to delete application: %v", err)
|
||||
}
|
||||
deleteCephfsPlugin()
|
||||
|
||||
// switch back to current changes.
|
||||
err = os.Chdir(cwd)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to d chdir with error %v", err)
|
||||
e2elog.Failf("failed to d chdir: %v", err)
|
||||
}
|
||||
deployCephfsPlugin()
|
||||
|
||||
err = waitForDeploymentComplete(cephFSDeploymentName, cephCSINamespace, f.ClientSet, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("timeout waiting for upgraded deployment %s with error %v", cephFSDeploymentName, err)
|
||||
e2elog.Failf("timeout waiting for upgraded deployment %s: %v", cephFSDeploymentName, err)
|
||||
}
|
||||
|
||||
err = waitForDaemonSets(cephFSDeamonSetName, cephCSINamespace, f.ClientSet, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("timeout waiting for upgraded daemonset %s with error %v", cephFSDeamonSetName, err)
|
||||
e2elog.Failf("timeout waiting for upgraded daemonset %s: %v", cephFSDeamonSetName, err)
|
||||
}
|
||||
|
||||
app.Labels = label
|
||||
@ -256,7 +256,7 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
// an earlier release.
|
||||
err = createApp(f.ClientSet, app, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create application with error %v", err)
|
||||
e2elog.Failf("failed to create application: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
@ -269,13 +269,13 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 17) {
|
||||
pvcClone, err = loadPVC(pvcClonePath)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to load pvc with error %v", err)
|
||||
e2elog.Failf("failed to load pvc: %v", err)
|
||||
}
|
||||
pvcClone.Namespace = f.UniqueName
|
||||
pvcClone.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(pvcSize)
|
||||
appClone, err = loadApp(appClonePath)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to load application with error %v", err)
|
||||
e2elog.Failf("failed to load application: %v", err)
|
||||
}
|
||||
label[appKey] = "validate-snap-cephfs"
|
||||
appClone.Namespace = f.UniqueName
|
||||
@ -283,7 +283,7 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
appClone.Labels = label
|
||||
err = createPVCAndApp("", f, pvcClone, appClone, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create pvc and application with error %v", err)
|
||||
e2elog.Failf("failed to create pvc and application: %v", err)
|
||||
}
|
||||
opt := metav1.ListOptions{
|
||||
LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]),
|
||||
@ -292,7 +292,7 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
testFilePath := filepath.Join(mountPath, "testClone")
|
||||
newCheckSum, err = calculateSHA512sum(f, appClone, testFilePath, &opt)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to calculate checksum with error %v", err)
|
||||
e2elog.Failf("failed to calculate checksum: %v", err)
|
||||
}
|
||||
|
||||
if strings.Compare(newCheckSum, checkSum) != 0 {
|
||||
@ -332,14 +332,14 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 16) {
|
||||
pvcClone, err = loadPVC(pvcSmartClonePath)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to load pvc with error %v", err)
|
||||
e2elog.Failf("failed to load pvc: %v", err)
|
||||
}
|
||||
pvcClone.Spec.DataSource.Name = pvc.Name
|
||||
pvcClone.Namespace = f.UniqueName
|
||||
pvcClone.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(pvcSize)
|
||||
appClone, err = loadApp(appSmartClonePath)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to load application with error %v", err)
|
||||
e2elog.Failf("failed to load application: %v", err)
|
||||
}
|
||||
label[appKey] = "validate-snap-cephfs"
|
||||
appClone.Namespace = f.UniqueName
|
||||
@ -347,7 +347,7 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
appClone.Labels = label
|
||||
err = createPVCAndApp("", f, pvcClone, appClone, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create pvc and application with error %v", err)
|
||||
e2elog.Failf("failed to create pvc and application: %v", err)
|
||||
}
|
||||
opt := metav1.ListOptions{
|
||||
LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]),
|
||||
@ -356,7 +356,7 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
testFilePath := filepath.Join(mountPath, "testClone")
|
||||
newCheckSum, err = calculateSHA512sum(f, appClone, testFilePath, &opt)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to calculate checksum with error %v", err)
|
||||
e2elog.Failf("failed to calculate checksum: %v", err)
|
||||
}
|
||||
|
||||
if strings.Compare(newCheckSum, checkSum) != 0 {
|
||||
@ -370,7 +370,7 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
// delete cloned pvc and pod
|
||||
err = deletePVCAndApp("", f, pvcClone, appClone)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete pvc and application with error %v", err)
|
||||
e2elog.Failf("failed to delete pvc and application: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -390,23 +390,23 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
PersistentVolumeClaims(pvc.Namespace).
|
||||
Get(context.TODO(), pvc.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to get pvc with error %v", err)
|
||||
e2elog.Failf("failed to get pvc: %v", err)
|
||||
}
|
||||
|
||||
// resize PVC
|
||||
err = expandPVCSize(f.ClientSet, pvc, pvcExpandSize, deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to expand pvc with error %v", err)
|
||||
e2elog.Failf("failed to expand pvc: %v", err)
|
||||
}
|
||||
// wait for application pod to come up after resize
|
||||
err = waitForPodInRunningState(app.Name, app.Namespace, f.ClientSet, deployTimeout, noError)
|
||||
if err != nil {
|
||||
e2elog.Failf("timeout waiting for pod to be in running state with error %v", err)
|
||||
e2elog.Failf("timeout waiting for pod to be in running state: %v", err)
|
||||
}
|
||||
// validate if resize is successful.
|
||||
err = checkDirSize(app, f, &opt, pvcExpandSize)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to check directory size with error %v", err)
|
||||
e2elog.Failf("failed to check directory size: %v", err)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -414,17 +414,17 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
||||
By("delete pvc and app")
|
||||
err = deletePVCAndApp("", f, pvc, app)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete pvc and application with error %v", err)
|
||||
e2elog.Failf("failed to delete pvc and application: %v", err)
|
||||
}
|
||||
// delete cephFS provisioner secret
|
||||
err = deleteCephUser(f, keyringCephFSProvisionerUsername)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete user %s with error %v", keyringCephFSProvisionerUsername, err)
|
||||
e2elog.Failf("failed to delete user %s: %v", keyringCephFSProvisionerUsername, err)
|
||||
}
|
||||
// delete cephFS plugin secret
|
||||
err = deleteCephUser(f, keyringCephFSNodePluginUsername)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to delete user %s with error %v", keyringCephFSNodePluginUsername, err)
|
||||
e2elog.Failf("failed to delete user %s: %v", keyringCephFSNodePluginUsername, err)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user