Starting with version 15.04, ubuntu is based on systemd. The existing ubuntu provider did not support systemd. This commit introduce a new provider dedicated to systemd based versions. The previous provider is renamed to ubuntu_upstart. Provider detection uses the /etc/os=release VERSION_ID. Version ID is converted to a float value and then used to choose between providers. Unit tests are validating the provisioner compatibility. Fixes #1891 Signed-off-by: Thomas Recloux <thomas.recloux@gmail.com>
30 lines
503 B
Go
30 lines
503 B
Go
package provision
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestUbuntuSystemdCompatibleWithHost(t *testing.T) {
|
|
info := &OsRelease{
|
|
ID: "ubuntu",
|
|
VersionID: "15.04",
|
|
}
|
|
p := NewUbuntuSystemdProvisioner(nil)
|
|
p.SetOsReleaseInfo(info)
|
|
|
|
compatible := p.CompatibleWithHost()
|
|
|
|
if !compatible {
|
|
t.Fatalf("expected to be compatible with ubuntu 15.04")
|
|
}
|
|
|
|
info.VersionID = "14.04"
|
|
|
|
compatible = p.CompatibleWithHost()
|
|
|
|
if compatible {
|
|
t.Fatalf("expected to NOT be compatible with ubuntu 14.04")
|
|
}
|
|
|
|
}
|