Fix tests.

This commit is contained in:
Tom Wilkie 2018-01-31 15:22:17 +00:00
parent 0316bacceb
commit 6833eec187

View file

@ -22,9 +22,10 @@ import (
) )
// Creates mock UnitLists // Creates mock UnitLists
func getUnitListFixtures() [][]dbus.UnitStatus { func getUnitListFixtures() [][]unit {
fixture1 := []dbus.UnitStatus{ fixture1 := []unit{
{ {
UnitStatus: dbus.UnitStatus{
Name: "foo", Name: "foo",
Description: "foo desc", Description: "foo desc",
LoadState: "loaded", LoadState: "loaded",
@ -36,7 +37,9 @@ func getUnitListFixtures() [][]dbus.UnitStatus {
JobType: "", JobType: "",
JobPath: "/", JobPath: "/",
}, },
},
{ {
UnitStatus: dbus.UnitStatus{
Name: "bar", Name: "bar",
Description: "bar desc", Description: "bar desc",
LoadState: "not-found", LoadState: "not-found",
@ -48,7 +51,9 @@ func getUnitListFixtures() [][]dbus.UnitStatus {
JobType: "", JobType: "",
JobPath: "/", JobPath: "/",
}, },
},
{ {
UnitStatus: dbus.UnitStatus{
Name: "foobar", Name: "foobar",
Description: "bar desc", Description: "bar desc",
LoadState: "not-found", LoadState: "not-found",
@ -60,7 +65,9 @@ func getUnitListFixtures() [][]dbus.UnitStatus {
JobType: "", JobType: "",
JobPath: "/", JobPath: "/",
}, },
},
{ {
UnitStatus: dbus.UnitStatus{
Name: "baz", Name: "baz",
Description: "bar desc", Description: "bar desc",
LoadState: "not-found", LoadState: "not-found",
@ -72,11 +79,12 @@ func getUnitListFixtures() [][]dbus.UnitStatus {
JobType: "", JobType: "",
JobPath: "/", JobPath: "/",
}, },
},
} }
fixture2 := []dbus.UnitStatus{} fixture2 := []unit{}
return [][]dbus.UnitStatus{fixture1, fixture2} return [][]unit{fixture1, fixture2}
} }
func TestSystemdCollectorDoesntCrash(t *testing.T) { func TestSystemdCollectorDoesntCrash(t *testing.T) {