Browse Source

Fix tests.

pull/807/head
Tom Wilkie 7 years ago
parent
commit
6833eec187
  1. 16
      collector/systemd_linux_test.go

16
collector/systemd_linux_test.go

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

Loading…
Cancel
Save