In gccgo or newer go versions we can't assume that map ordering is fixed, which results in some new test failures, for example:
dooferlad@homework2:~/juju/service$ go test
----------------------------------------------------------------------
FAIL: service_test.go:49: serviceSuite.TestListServicesCommand
service_test.go:64:
c.Check(cmd, gc.Equals, strings.Join([]string{
fmt.Sprintf(line, "/sbin/init", upstart),
"el" + fmt.Sprintf(line, "/sbin/upstart", upstart),
"el" + fmt.Sprintf(line, "/sbin/systemd", systemd),
"el" + fmt.Sprintf(line, "/bin/systemd", systemd),
"el" + fmt.Sprintf(line, "/lib/systemd/systemd", systemd),
"else exit 1",
"fi",
}, "\n"))
... obtained string = "" +
... "if [[ \"$(cat /proc/1/cmdline)\" == \"/lib/systemd/systemd\" ]]; then /bin/systemctl list-unit-files --no-legend --no-page -t service | grep -o -P '^\\w[\\S]*(?=\\.service)'\n" +
... "elif [[ \"$(cat /proc/1/cmdline)\" == \"/sbin/init\" ]]; then sudo initctl list | awk '{print $1}' | sort | uniq\n" +
... "elif [[ \"$(cat /proc/1/cmdline)\" == \"/sbin/upstart\" ]]; then sudo initctl list | awk '{print $1}' | sort | uniq\n" +
... "elif [[ \"$(cat /proc/1/cmdline)\" == \"/sbin/systemd\" ]]; then /bin/systemctl list-unit-files --no-legend --no-page -t service | grep -o -P '^\\w[\\S]*(?=\\.service)'\n" +
... "elif [[ \"$(cat /proc/1/cmdline)\" == \"/bin/systemd\" ]]; then /bin/systemctl list-unit-files --no-legend --no-page -t service | grep -o -P '^\\w[\\S]*(?=\\.service)'\n" +
... "else exit 1\n" +
... "fi"
... expected string = "" +
... "if [[ \"$(cat /proc/1/cmdline)\" == \"/sbin/init\" ]]; then sudo initctl list | awk '{print $1}' | sort | uniq\n" +
... "elif [[ \"$(cat /proc/1/cmdline)\" == \"/sbin/upstart\" ]]; then sudo initctl list | awk '{print $1}' | sort | uniq\n" +
... "elif [[ \"$(cat /proc/1/cmdline)\" == \"/sbin/systemd\" ]]; then /bin/systemctl list-unit-files --no-legend --no-page -t service | grep -o -P '^\\w[\\S]*(?=\\.service)'\n" +
... "elif [[ \"$(cat /proc/1/cmdline)\" == \"/bin/systemd\" ]]; then /bin/systemctl list-unit-files --no-legend --no-page -t service | grep -o -P '^\\w[\\S]*(?=\\.service)'\n" +
... "elif [[ \"$(cat /proc/1/cmdline)\" == \"/lib/systemd/systemd\" ]]; then /bin/systemctl list-unit-files --no-legend --no-page -t service | grep -o -P '^\\w[\\S]*(?=\\.service)'\n" +
... "else exit 1\n" +
... "fi"
OOPS: 5 passed, 1 FAILED
--- FAIL: TestPackage (0.01s)
FAIL
exit status 1
FAIL github.com/juju/juju/service 0.022s
Fix proposed with http:// reviews. vapour. ws/r/1048/