e2e: update E2E testing for snapshot

with new implemntation when user creates a snapshot
in backend we are creating rbd image, we need to
validate the total images count in backend when
creating snapshots and clones.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2020-06-09 14:51:03 +05:30
committed by mergify[bot]
parent 567b2ab280
commit 47fb5f2299
2 changed files with 74 additions and 34 deletions

View File

@ -2,7 +2,6 @@ package e2e
import (
"context"
"encoding/json"
"fmt"
"strings"
"time"
@ -18,13 +17,6 @@ import (
testutils "k8s.io/kubernetes/test/utils"
)
type snapInfo struct {
ID int64 `json:"id"`
Name string `json:"name"`
Size int64 `json:"size"`
Timestamp string `json:"timestamp"`
}
func getSnapshotClass(path string) snapapi.VolumeSnapshotClass {
sc := snapapi.VolumeSnapshotClass{}
err := unmarshal(path, &sc)
@ -121,17 +113,6 @@ func deleteSnapshot(snap *snapapi.VolumeSnapshot, t int) error {
})
}
func listSnapshots(f *framework.Framework, pool, imageName string) ([]snapInfo, error) {
command := fmt.Sprintf("rbd snap ls %s/%s --format=json", pool, imageName)
stdout, stdErr := execCommandInToolBoxPod(f, command, rookNamespace)
Expect(stdErr).Should(BeEmpty())
var snapInfos []snapInfo
err := json.Unmarshal([]byte(stdout), &snapInfos)
return snapInfos, err
}
func createRBDSnapshotClass(f *framework.Framework) {
scPath := fmt.Sprintf("%s/%s", rbdExamplePath, "snapshotclass.yaml")
sc := getSnapshotClass(scPath)