fix TODO use time.Time for createSnapshot & solute conflict
This commit is contained in:
@@ -27,10 +27,11 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
var timeNow = time.Now().UnixNano()
|
||||
var timeNow = time.Now()
|
||||
var timeNowStamp = timeNow.UnixNano()
|
||||
|
||||
var metaTimeNowUnix = &metav1.Time{
|
||||
Time: time.Unix(0, timeNow),
|
||||
Time: timeNow,
|
||||
}
|
||||
|
||||
var defaultSize int64 = 1000
|
||||
@@ -68,7 +69,7 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
{
|
||||
name: "6-1 - successful create snapshot with snapshot class gold",
|
||||
initialContents: nocontents,
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-1", classGold, "sid6-1", "pv-uid6-1", "volume6-1", "snapuid6-1", "snap6-1", &deletePolicy, &defaultSize, &timeNow, false),
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-1", classGold, "sid6-1", "pv-uid6-1", "volume6-1", "snapuid6-1", "snap6-1", &deletePolicy, &defaultSize, &timeNowStamp, false),
|
||||
initialSnapshots: newSnapshotArray("snap6-1", classGold, "", "snapuid6-1", "claim6-1", false, nil, nil, nil),
|
||||
expectedSnapshots: newSnapshotArray("snap6-1", classGold, "snapcontent-snapuid6-1", "snapuid6-1", "claim6-1", false, nil, metaTimeNowUnix, getSize(defaultSize)),
|
||||
initialClaims: newClaimArray("claim6-1", "pvc-uid6-1", "1Gi", "volume6-1", v1.ClaimBound, &classEmpty),
|
||||
@@ -79,11 +80,11 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
volume: newVolume("volume6-1", "pv-uid6-1", "pv-handle6-1", "1Gi", "pvc-uid6-1", "claim6-1", v1.VolumeBound, v1.PersistentVolumeReclaimDelete, classEmpty),
|
||||
parameters: map[string]string{"param1": "value1"},
|
||||
// information to return
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-1",
|
||||
timestamp: timeNow,
|
||||
readyToUse: true,
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-1",
|
||||
creationTime: timeNow,
|
||||
readyToUse: true,
|
||||
},
|
||||
},
|
||||
errors: noerrors,
|
||||
@@ -92,7 +93,7 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
{
|
||||
name: "6-2 - successful create snapshot with snapshot class silver",
|
||||
initialContents: nocontents,
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-2", classSilver, "sid6-2", "pv-uid6-2", "volume6-2", "snapuid6-2", "snap6-2", &deletePolicy, &defaultSize, &timeNow, false),
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-2", classSilver, "sid6-2", "pv-uid6-2", "volume6-2", "snapuid6-2", "snap6-2", &deletePolicy, &defaultSize, &timeNowStamp, false),
|
||||
initialSnapshots: newSnapshotArray("snap6-2", classSilver, "", "snapuid6-2", "claim6-2", false, nil, nil, nil),
|
||||
expectedSnapshots: newSnapshotArray("snap6-2", classSilver, "snapcontent-snapuid6-2", "snapuid6-2", "claim6-2", false, nil, metaTimeNowUnix, getSize(defaultSize)),
|
||||
initialClaims: newClaimArray("claim6-2", "pvc-uid6-2", "1Gi", "volume6-2", v1.ClaimBound, &classEmpty),
|
||||
@@ -103,11 +104,11 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
volume: newVolume("volume6-2", "pv-uid6-2", "pv-handle6-2", "1Gi", "pvc-uid6-2", "claim6-2", v1.VolumeBound, v1.PersistentVolumeReclaimDelete, classEmpty),
|
||||
parameters: map[string]string{"param2": "value2"},
|
||||
// information to return
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-2",
|
||||
timestamp: timeNow,
|
||||
readyToUse: true,
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-2",
|
||||
creationTime: timeNow,
|
||||
readyToUse: true,
|
||||
},
|
||||
},
|
||||
errors: noerrors,
|
||||
@@ -116,7 +117,7 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
{
|
||||
name: "6-3 - successful create snapshot with snapshot class valid-secret-class",
|
||||
initialContents: nocontents,
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-3", validSecretClass, "sid6-3", "pv-uid6-3", "volume6-3", "snapuid6-3", "snap6-3", &deletePolicy, &defaultSize, &timeNow, false),
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-3", validSecretClass, "sid6-3", "pv-uid6-3", "volume6-3", "snapuid6-3", "snap6-3", &deletePolicy, &defaultSize, &timeNowStamp, false),
|
||||
initialSnapshots: newSnapshotArray("snap6-3", validSecretClass, "", "snapuid6-3", "claim6-3", false, nil, nil, nil),
|
||||
expectedSnapshots: newSnapshotArray("snap6-3", validSecretClass, "snapcontent-snapuid6-3", "snapuid6-3", "claim6-3", false, nil, metaTimeNowUnix, getSize(defaultSize)),
|
||||
initialClaims: newClaimArray("claim6-3", "pvc-uid6-3", "1Gi", "volume6-3", v1.ClaimBound, &classEmpty),
|
||||
@@ -129,11 +130,11 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
parameters: class5Parameters,
|
||||
secrets: map[string]string{"foo": "bar"},
|
||||
// information to return
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-3",
|
||||
timestamp: timeNow,
|
||||
readyToUse: true,
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-3",
|
||||
creationTime: timeNow,
|
||||
readyToUse: true,
|
||||
},
|
||||
},
|
||||
errors: noerrors,
|
||||
@@ -142,7 +143,7 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
{
|
||||
name: "6-4 - successful create snapshot with snapshot class empty-secret-class",
|
||||
initialContents: nocontents,
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-4", emptySecretClass, "sid6-4", "pv-uid6-4", "volume6-4", "snapuid6-4", "snap6-4", &deletePolicy, &defaultSize, &timeNow, false),
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-4", emptySecretClass, "sid6-4", "pv-uid6-4", "volume6-4", "snapuid6-4", "snap6-4", &deletePolicy, &defaultSize, &timeNowStamp, false),
|
||||
initialSnapshots: newSnapshotArray("snap6-4", emptySecretClass, "", "snapuid6-4", "claim6-4", false, nil, nil, nil),
|
||||
expectedSnapshots: newSnapshotArray("snap6-4", emptySecretClass, "snapcontent-snapuid6-4", "snapuid6-4", "claim6-4", false, nil, metaTimeNowUnix, getSize(defaultSize)),
|
||||
initialClaims: newClaimArray("claim6-4", "pvc-uid6-4", "1Gi", "volume6-4", v1.ClaimBound, &classEmpty),
|
||||
@@ -155,11 +156,11 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
parameters: class4Parameters,
|
||||
secrets: map[string]string{},
|
||||
// information to return
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-4",
|
||||
timestamp: timeNow,
|
||||
readyToUse: true,
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-4",
|
||||
creationTime: timeNow,
|
||||
readyToUse: true,
|
||||
},
|
||||
},
|
||||
errors: noerrors,
|
||||
@@ -168,7 +169,7 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
{
|
||||
name: "6-5 - successful create snapshot with status uploading",
|
||||
initialContents: nocontents,
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-5", classGold, "sid6-5", "pv-uid6-5", "volume6-5", "snapuid6-5", "snap6-5", &deletePolicy, &defaultSize, &timeNow, false),
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-5", classGold, "sid6-5", "pv-uid6-5", "volume6-5", "snapuid6-5", "snap6-5", &deletePolicy, &defaultSize, &timeNowStamp, false),
|
||||
initialSnapshots: newSnapshotArray("snap6-5", classGold, "", "snapuid6-5", "claim6-5", false, nil, nil, nil),
|
||||
expectedSnapshots: newSnapshotArray("snap6-5", classGold, "snapcontent-snapuid6-5", "snapuid6-5", "claim6-5", false, nil, metaTimeNowUnix, getSize(defaultSize)),
|
||||
initialClaims: newClaimArray("claim6-5", "pvc-uid6-5", "1Gi", "volume6-5", v1.ClaimBound, &classEmpty),
|
||||
@@ -179,11 +180,11 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
volume: newVolume("volume6-5", "pv-uid6-5", "pv-handle6-5", "1Gi", "pvc-uid6-5", "claim6-5", v1.VolumeBound, v1.PersistentVolumeReclaimDelete, classEmpty),
|
||||
parameters: map[string]string{"param1": "value1"},
|
||||
// information to return
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-5",
|
||||
timestamp: timeNow,
|
||||
readyToUse: true,
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-5",
|
||||
creationTime: timeNow,
|
||||
readyToUse: true,
|
||||
},
|
||||
},
|
||||
errors: noerrors,
|
||||
@@ -192,7 +193,7 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
{
|
||||
name: "6-6 - successful create snapshot with status error uploading",
|
||||
initialContents: nocontents,
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-6", classGold, "sid6-6", "pv-uid6-6", "volume6-6", "snapuid6-6", "snap6-6", &deletePolicy, &defaultSize, &timeNow, false),
|
||||
expectedContents: newContentArray("snapcontent-snapuid6-6", classGold, "sid6-6", "pv-uid6-6", "volume6-6", "snapuid6-6", "snap6-6", &deletePolicy, &defaultSize, &timeNowStamp, false),
|
||||
initialSnapshots: newSnapshotArray("snap6-6", classGold, "", "snapuid6-6", "claim6-6", false, nil, nil, nil),
|
||||
expectedSnapshots: newSnapshotArray("snap6-6", classGold, "snapcontent-snapuid6-6", "snapuid6-6", "claim6-6", false, nil, metaTimeNowUnix, getSize(defaultSize)),
|
||||
initialClaims: newClaimArray("claim6-6", "pvc-uid6-6", "1Gi", "volume6-6", v1.ClaimBound, &classEmpty),
|
||||
@@ -203,11 +204,11 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
volume: newVolume("volume6-6", "pv-uid6-6", "pv-handle6-6", "1Gi", "pvc-uid6-6", "claim6-6", v1.VolumeBound, v1.PersistentVolumeReclaimDelete, classEmpty),
|
||||
parameters: map[string]string{"param1": "value1"},
|
||||
// information to return
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-6",
|
||||
timestamp: timeNow,
|
||||
readyToUse: true,
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid6-6",
|
||||
creationTime: timeNow,
|
||||
readyToUse: true,
|
||||
},
|
||||
},
|
||||
errors: noerrors,
|
||||
@@ -318,11 +319,11 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
volume: newVolume("volume7-8", "pv-uid7-8", "pv-handle7-8", "1Gi", "pvc-uid7-8", "claim7-8", v1.VolumeBound, v1.PersistentVolumeReclaimDelete, classEmpty),
|
||||
parameters: map[string]string{"param1": "value1"},
|
||||
// information to return
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid7-8",
|
||||
timestamp: timeNow,
|
||||
readyToUse: true,
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid7-8",
|
||||
creationTime: timeNow,
|
||||
readyToUse: true,
|
||||
},
|
||||
},
|
||||
errors: []reactorError{
|
||||
@@ -349,11 +350,11 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
volume: newVolume("volume7-9", "pv-uid7-9", "pv-handle7-9", "1Gi", "pvc-uid7-9", "claim7-9", v1.VolumeBound, v1.PersistentVolumeReclaimDelete, classEmpty),
|
||||
parameters: map[string]string{"param1": "value1"},
|
||||
// information to return
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid7-9",
|
||||
timestamp: timeNow,
|
||||
readyToUse: true,
|
||||
driverName: mockDriverName,
|
||||
size: defaultSize,
|
||||
snapshotId: "sid7-9",
|
||||
creationTime: timeNow,
|
||||
readyToUse: true,
|
||||
},
|
||||
},
|
||||
errors: []reactorError{
|
||||
|
Reference in New Issue
Block a user