Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Barrick committed Mar 5, 2019
1 parent 4e9c09b commit db8bbe5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
if contentSource != nil {
snapshot := contentSource.GetSnapshot()
if snapshot != nil {
ll.Info("using snapshot as volume source")
ll.WithField("snapshot_id", snapshot.GetId()).Info("using snapshot as volume source")
volumeReq.SnapshotID = snapshot.GetId()
}
}
Expand Down
24 changes: 7 additions & 17 deletions test/kubernetes/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,22 +358,6 @@ func TestSnapshot_Create(t *testing.T) {
Name: "my-csi-app-2",
},
Spec: v1.PodSpec{
InitContainers: []v1.Container{
{
Name: "my-csi",
Image: "busybox",
VolumeMounts: []v1.VolumeMount{
{
MountPath: "/data",
Name: volumeName,
},
},
Command: []string{
"sh", "-c",
"echo testcanary > /data/canary",
},
},
},
Containers: []v1.Container{
{
Name: "my-csi-app",
Expand All @@ -385,7 +369,8 @@ func TestSnapshot_Create(t *testing.T) {
},
},
Command: []string{
"sleep", "1000000",
"sh", "-c",
"echo testcanary > /data/canary && sleep 1000000",
},
},
},
Expand Down Expand Up @@ -491,6 +476,11 @@ func TestSnapshot_Create(t *testing.T) {
Name: "my-csi-app-2-restored",
},
Spec: v1.PodSpec{
// This init container verifies that the /data/canary file is present.
// If it is not, then the volume was not properly restored.
// waitForPod only waits for the pod to enter the running state, so will not
// detect any failures after that, so this has to be an InitContainer so that
// the pod never enters the running state if it fails.
InitContainers: []v1.Container{
{
Name: "my-csi",
Expand Down

0 comments on commit db8bbe5

Please sign in to comment.