mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-11 22:10:11 +01:00
fix(sanity): fixing flaky sanity test case
Also moving to bionic docker image for github action also. Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
parent
2ae14f556b
commit
0409fca095
3 changed files with 34 additions and 8 deletions
|
|
@ -41,7 +41,7 @@ COPY . .
|
|||
|
||||
RUN make buildx.csi-driver
|
||||
|
||||
FROM ubuntu:19.10
|
||||
FROM ubuntu:18.04
|
||||
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update; exit 0
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ EOT
|
|||
|
||||
function startTestSuite() {
|
||||
echo "================== Start csi-sanity test suite ================="
|
||||
./csi-sanity --ginkgo.v --csi.controllerendpoint=///tmp/csi.sock --csi.endpoint=/var/lib/kubelet/plugins/zfs-localpv/csi.sock --csi.testvolumeparameters=/tmp/parameters.json
|
||||
./csi-sanity --ginkgo.v --csi.controllerendpoint=///tmp/csi.sock --csi.endpoint=/var/lib/kubelet/plugins/zfs-localpv/csi.sock --csi.testvolumeparameters=/tmp/parameters.json --csi.testsnapshotparameters=/tmp/parameters.json
|
||||
if [ $? -ne 0 ];
|
||||
then
|
||||
dumpAllLogs
|
||||
|
|
|
|||
|
|
@ -133,6 +133,23 @@ func waitForVolDestroy(volname string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func waitForReadySnapshot(snapname string) error {
|
||||
for true {
|
||||
snap, err := zfs.GetZFSSnapshot(snapname)
|
||||
if err != nil {
|
||||
return status.Errorf(codes.Internal,
|
||||
"zfs: wait failed, not able to get the snapshot %s %s", snapname, err.Error())
|
||||
}
|
||||
|
||||
switch snap.Status.State {
|
||||
case zfs.ZFSStatusReady:
|
||||
return nil
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateZFSVolume create new zfs volume from csi volume request
|
||||
func CreateZFSVolume(req *csi.CreateVolumeRequest) (string, error) {
|
||||
volName := strings.ToLower(req.GetName())
|
||||
|
|
@ -224,12 +241,6 @@ func CreateZFSVolume(req *csi.CreateVolumeRequest) (string, error) {
|
|||
"not able to provision the volume %s", err.Error())
|
||||
}
|
||||
|
||||
if _, ok := parameters["wait"]; ok {
|
||||
if err := waitForReadyVolume(volName); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
return selected, nil
|
||||
}
|
||||
|
||||
|
|
@ -370,6 +381,12 @@ func (cs *controller) CreateVolume(
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if _, ok := parameters["wait"]; ok {
|
||||
if err := waitForReadyVolume(volName); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
sendEventOrIgnore(pvcName, volName, strconv.FormatInt(int64(size), 10), "zfs-localpv", analytics.VolumeProvision)
|
||||
|
||||
topology := map[string]string{zfs.ZFSTopologyKey: selected}
|
||||
|
|
@ -661,6 +678,15 @@ func (cs *controller) CreateSnapshot(
|
|||
)
|
||||
}
|
||||
|
||||
originalParams := req.GetParameters()
|
||||
parameters := helpers.GetCaseInsensitiveMap(&originalParams)
|
||||
|
||||
if _, ok := parameters["wait"]; ok {
|
||||
if err := waitForReadySnapshot(snapName); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
state, _ = zfs.GetZFSSnapshotStatus(snapName)
|
||||
|
||||
return csipayload.NewCreateSnapshotResponseBuilder().
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue