changes code to improve output for files under test/e2e/storage

This commit is contained in:
Joe Betz
2022-04-11 13:19:54 -04:00
committed by SD-13
parent 1913c6be35
commit 7be77f9ecc
24 changed files with 193 additions and 65 deletions

View File

@@ -124,7 +124,9 @@ func (n *nfsDriver) SkipUnsupportedTest(pattern storageframework.TestPattern) {
func (n *nfsDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
nv, ok := e2evolume.(*nfsVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to NFS test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the NFS test volume", e2evolume)
}
return &v1.VolumeSource{
NFS: &v1.NFSVolumeSource{
Server: nv.serverHost,
@@ -136,7 +138,9 @@ func (n *nfsDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume stor
func (n *nfsDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
nv, ok := e2evolume.(*nfsVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to NFS test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the NFS test volume", e2evolume)
}
return &v1.PersistentVolumeSource{
NFS: &v1.NFSVolumeSource{
Server: nv.serverHost,
@@ -264,7 +268,9 @@ func (g *glusterFSDriver) SkipUnsupportedTest(pattern storageframework.TestPatte
func (g *glusterFSDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
gv, ok := e2evolume.(*glusterVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to Gluster test volume")
if !ok {
framework.Failf("failed to cast test volume type %T to the Gluster test volume", e2evolume)
}
name := gv.prefix + "-server"
return &v1.VolumeSource{
@@ -279,7 +285,9 @@ func (g *glusterFSDriver) GetVolumeSource(readOnly bool, fsType string, e2evolum
func (g *glusterFSDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
gv, ok := e2evolume.(*glusterVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to Gluster test volume")
if !ok {
framework.Failf("failed to cast test volume of type %T to the Gluster test volume", e2evolume)
}
name := gv.prefix + "-server"
return &v1.PersistentVolumeSource{
@@ -399,7 +407,9 @@ func (i *iSCSIDriver) SkipUnsupportedTest(pattern storageframework.TestPattern)
func (i *iSCSIDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
iv, ok := e2evolume.(*iSCSIVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to iSCSI test volume")
if !ok {
framework.Failf("failed to cast test volume of type %T to the iSCSI test volume", e2evolume)
}
volSource := v1.VolumeSource{
ISCSI: &v1.ISCSIVolumeSource{
@@ -417,7 +427,9 @@ func (i *iSCSIDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume st
func (i *iSCSIDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
iv, ok := e2evolume.(*iSCSIVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to iSCSI test volume")
if !ok {
framework.Failf("failed to cast test volume of type %T to the iSCSI test volume", e2evolume)
}
pvSource := v1.PersistentVolumeSource{
ISCSI: &v1.ISCSIPersistentVolumeSource{
@@ -576,7 +588,9 @@ func (r *rbdDriver) SkipUnsupportedTest(pattern storageframework.TestPattern) {
func (r *rbdDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
rv, ok := e2evolume.(*rbdVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to RBD test volume")
if !ok {
framework.Failf("failed to cast test volume of type %T to the RBD test volume", e2evolume)
}
volSource := v1.VolumeSource{
RBD: &v1.RBDVolumeSource{
@@ -598,7 +612,9 @@ func (r *rbdDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume stor
func (r *rbdDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
rv, ok := e2evolume.(*rbdVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to RBD test volume")
if !ok {
framework.Failf("failed to cast test volume of type %T to the RBD test volume", e2evolume)
}
f := rv.f
ns := f.Namespace
@@ -699,7 +715,9 @@ func (c *cephFSDriver) SkipUnsupportedTest(pattern storageframework.TestPattern)
func (c *cephFSDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
cv, ok := e2evolume.(*cephVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to Ceph test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the Ceph test volume", e2evolume)
}
return &v1.VolumeSource{
CephFS: &v1.CephFSVolumeSource{
@@ -715,7 +733,9 @@ func (c *cephFSDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume s
func (c *cephFSDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
cv, ok := e2evolume.(*cephVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to Ceph test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the Ceph test volume", e2evolume)
}
ns := cv.f.Namespace
@@ -873,7 +893,9 @@ func (h *hostPathSymlinkDriver) SkipUnsupportedTest(pattern storageframework.Tes
func (h *hostPathSymlinkDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
hv, ok := e2evolume.(*hostPathSymlinkVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to Hostpath Symlink test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the Hostpath Symlink test volume", e2evolume)
}
// hostPathSymlink doesn't support readOnly volume
if readOnly {
@@ -1134,7 +1156,9 @@ func (g *gcePdDriver) SkipUnsupportedTest(pattern storageframework.TestPattern)
func (g *gcePdDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
gv, ok := e2evolume.(*gcePdVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to GCE PD test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the GCE PD test volume", e2evolume)
}
volSource := v1.VolumeSource{
GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{
PDName: gv.volumeName,
@@ -1149,7 +1173,9 @@ func (g *gcePdDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume st
func (g *gcePdDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
gv, ok := e2evolume.(*gcePdVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to GCE PD test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the GCE PD test volume", e2evolume)
}
pvSource := v1.PersistentVolumeSource{
GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{
PDName: gv.volumeName,
@@ -1268,7 +1294,9 @@ func (v *vSphereDriver) SkipUnsupportedTest(pattern storageframework.TestPattern
func (v *vSphereDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
vsv, ok := e2evolume.(*vSphereVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to vSphere test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the cSphere test volume", e2evolume)
}
// vSphere driver doesn't seem to support readOnly volume
// TODO: check if it is correct
@@ -1288,7 +1316,9 @@ func (v *vSphereDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume
func (v *vSphereDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
vsv, ok := e2evolume.(*vSphereVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to vSphere test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the vSphere test volume", e2evolume)
}
// vSphere driver doesn't seem to support readOnly volume
// TODO: check if it is correct
@@ -1407,7 +1437,9 @@ func (a *azureDiskDriver) SkipUnsupportedTest(pattern storageframework.TestPatte
func (a *azureDiskDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
av, ok := e2evolume.(*azureDiskVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to Azure test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the Azure test volume", e2evolume)
}
diskName := av.volumeName[(strings.LastIndex(av.volumeName, "/") + 1):]
kind := v1.AzureManagedDisk
@@ -1427,7 +1459,9 @@ func (a *azureDiskDriver) GetVolumeSource(readOnly bool, fsType string, e2evolum
func (a *azureDiskDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
av, ok := e2evolume.(*azureDiskVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to Azure test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the Azure test volume", e2evolume)
}
diskName := av.volumeName[(strings.LastIndex(av.volumeName, "/") + 1):]
@@ -1552,7 +1586,9 @@ func (a *awsDriver) SkipUnsupportedTest(pattern storageframework.TestPattern) {
func (a *awsDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
av, ok := e2evolume.(*awsVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to AWS test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the AWS test volume", e2evolume)
}
volSource := v1.VolumeSource{
AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{
VolumeID: av.volumeName,
@@ -1567,7 +1603,9 @@ func (a *awsDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume stor
func (a *awsDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
av, ok := e2evolume.(*awsVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to AWS test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the AWS test volume", e2evolume)
}
pvSource := v1.PersistentVolumeSource{
AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{
VolumeID: av.volumeName,
@@ -1808,7 +1846,9 @@ func (l *localDriver) nodeAffinityForNode(node *v1.Node) *v1.VolumeNodeAffinity
func (l *localDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
lv, ok := e2evolume.(*localVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to local test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the local test volume", e2evolume)
}
return &v1.PersistentVolumeSource{
Local: &v1.LocalVolumeSource{
Path: lv.ltr.Path,
@@ -1909,7 +1949,9 @@ func (a *azureFileDriver) SkipUnsupportedTest(pattern storageframework.TestPatte
func (a *azureFileDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
av, ok := e2evolume.(*azureFileVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to Azure test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the Azure test volume", e2evolume)
}
volSource := v1.VolumeSource{
AzureFile: &v1.AzureFileVolumeSource{
SecretName: av.secretName,
@@ -1922,7 +1964,9 @@ func (a *azureFileDriver) GetVolumeSource(readOnly bool, fsType string, e2evolum
func (a *azureFileDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
av, ok := e2evolume.(*azureFileVolume)
framework.ExpectEqual(ok, true, "Failed to cast test volume to Azure test volume")
if !ok {
framework.Failf("Failed to cast test volume of type %T to the Azure test volume", e2evolume)
}
pvSource := v1.PersistentVolumeSource{
AzureFile: &v1.AzureFilePersistentVolumeSource{
SecretName: av.secretName,