chore: do not set default volume driver to local, distinguish behaviour when it's set or not

This commit is contained in:
Pavel Sviderski
2025-04-21 16:53:43 +10:00
parent 835c310987
commit 143e68cc95
9 changed files with 128 additions and 55 deletions
+54 -3
View File
@@ -186,15 +186,66 @@ func TestEvalContainerSpecChange_Volumes(t *testing.T) {
Type: api.VolumeTypeVolume,
VolumeOptions: &api.VolumeOptions{
Name: "data",
Driver: &mount.Driver{
Name: "local",
},
},
},
},
},
expected: ContainerUpToDate,
},
{
name: "change volume driver to local",
current: api.ServiceSpec{
Volumes: []api.VolumeSpec{
{
Name: "data",
Type: api.VolumeTypeVolume,
},
},
},
new: api.ServiceSpec{
Volumes: []api.VolumeSpec{
{
Name: "data",
Type: api.VolumeTypeVolume,
VolumeOptions: &api.VolumeOptions{
Name: "data",
Driver: &mount.Driver{
Name: api.VolumeDriverLocal,
},
},
},
},
},
// TODO: this doesn't really require a recreate, only a spec update would be sufficient.
expected: ContainerNeedsRecreate,
},
{
name: "change volume driver to custom",
current: api.ServiceSpec{
Volumes: []api.VolumeSpec{
{
Name: "data",
Type: api.VolumeTypeVolume,
},
},
},
new: api.ServiceSpec{
Volumes: []api.VolumeSpec{
{
Name: "data",
Type: api.VolumeTypeVolume,
VolumeOptions: &api.VolumeOptions{
Name: "data",
Driver: &mount.Driver{
Name: "custom",
},
},
},
},
},
// TODO: this doesn't really require a recreate, only a spec update would be sufficient.
expected: ContainerNeedsRecreate,
},
{
name: "change bind option CreateHostPath",
current: api.ServiceSpec{