mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 03:53:33 +00:00
chore(volumes): e2e test when volume doesn't exist
This commit is contained in:
@@ -611,6 +611,36 @@ func TestDeployment(t *testing.T) {
|
|||||||
assert.Equal(t, c.Machines[2].Name, machine.Machine.Name, "Containers should only be on machine #2")
|
assert.Equal(t, c.Machines[2].Name, machine.Machine.Name, "Containers should only be on machine #2")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Deployments with volumes.
|
||||||
|
t.Run("fails when volume doesn't exist", func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
name := "test-nonexistent-volume"
|
||||||
|
spec := api.ServiceSpec{
|
||||||
|
Name: name,
|
||||||
|
Container: api.ContainerSpec{
|
||||||
|
Image: "portainer/pause:latest",
|
||||||
|
VolumeMounts: []api.VolumeMount{
|
||||||
|
{
|
||||||
|
VolumeName: "non-existent-volume",
|
||||||
|
ContainerPath: "/data",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Volumes: []api.VolumeSpec{
|
||||||
|
{
|
||||||
|
Name: "non-existent-volume",
|
||||||
|
Type: api.VolumeTypeVolume,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
d := deploy.NewDeployment(cli, spec, nil)
|
||||||
|
_, err := d.Run(ctx)
|
||||||
|
require.Error(t, err, "Deployment should fail when volume doesn't exist")
|
||||||
|
require.Contains(t, err.Error(), "volume 'non-existent-volume' not found")
|
||||||
|
})
|
||||||
|
|
||||||
// TODO: test deployments with unreachable machines. See https://github.com/psviderski/uncloud/issues/29.
|
// TODO: test deployments with unreachable machines. See https://github.com/psviderski/uncloud/issues/29.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user