func TestDecideStorageDriver(t *testing.T) { var tests = []struct { suppliedDriver string defaultDriver string remoteFilesystemType string expectedDriver string }{ {"", "aufs", "ext4", "aufs"}, {"", "aufs", "btrfs", "btrfs"}, {"", "overlay", "btrfs", "overlay"}, {"devicemapper", "aufs", "ext4", "devicemapper"}, {"devicemapper", "aufs", "btrfs", "devicemapper"}, } p := &fakeProvisioner{GenericProvisioner{ Driver: &fakedriver.Driver{}, }} for _, test := range tests { p.SSHCommander = provisiontest.NewFakeSSHCommander( provisiontest.FakeSSHCommanderOptions{ FilesystemType: test.remoteFilesystemType, }, ) storageDriver, err := decideStorageDriver(p, test.defaultDriver, test.suppliedDriver) assert.NoError(t, err) assert.Equal(t, test.expectedDriver, storageDriver) } }
func TestDebianDefaultStorageDriver(t *testing.T) { p := NewDebianProvisioner(&fakedriver.Driver{}).(*DebianProvisioner) p.SSHCommander = provisiontest.NewFakeSSHCommander(provisiontest.FakeSSHCommanderOptions{}) p.Provision(swarm.Options{}, auth.Options{}, engine.Options{}) if p.EngineOptions.StorageDriver != "aufs" { t.Fatal("Default storage driver should be aufs") } }
func TestRedHatDefaultStorageDriver(t *testing.T) { p := NewRedHatProvisioner("", &fakedriver.Driver{}) p.SSHCommander = provisiontest.NewFakeSSHCommander(provisiontest.FakeSSHCommanderOptions{}) p.Provision(swarm.Options{}, auth.Options{}, engine.Options{}) if p.EngineOptions.StorageDriver != "devicemapper" { t.Fatal("Default storage driver should be devicemapper") } }
func TestArchDefaultStorageDriver(t *testing.T) { p := NewArchProvisioner(&fakedriver.Driver{}).(*ArchProvisioner) p.SSHCommander = provisiontest.NewFakeSSHCommander(provisiontest.FakeSSHCommanderOptions{}) p.Provision(swarm.Options{}, auth.Options{}, engine.Options{}) if p.EngineOptions.StorageDriver != "overlay" { t.Fatal("Default storage driver should be overlay") } }