Exemplo n.º 1
0
func newTestRegistryForSsh() Registry {
	m1 := machine.MachineState{"c31e44e1-f858-436e-933e-59c642517860", "1.2.3.4", map[string]string{"ping": "pong"}}
	m2 := machine.MachineState{"595989bb-cbb7-49ce-8726-722d6e157b4e", "5.6.7.8", map[string]string{"foo": "bar"}}
	m3 := machine.MachineState{"hello.service", "8.7.6.5", map[string]string{"foo": "bar"}}
	machines := []machine.MachineState{m1, m2, m3}

	states := map[string]*job.JobState{
		"j1":            job.NewJobState("loaded", "active", "listening", []string{}, &m1),
		"j2":            job.NewJobState("loaded", "inactive", "dead", []string{}, &m2),
		"hello.service": job.NewJobState("loaded", "inactive", "dead", []string{}, &m3),
	}

	return TestRegistry{machines: machines, jobStates: states}
}
Exemplo n.º 2
0
func setupRegistryForStart(echoAttempts int) {
	m1 := machine.MachineState{"c31e44e1-f858-436e-933e-59c642517860", "1.2.3.4", map[string]string{"ping": "pong"}}
	m2 := machine.MachineState{"595989bb-cbb7-49ce-8726-722d6e157b4e", "5.6.7.8", map[string]string{"foo": "bar"}}
	m3 := machine.MachineState{"520983A8-FB9C-4A68-B49C-CED5BB2E9D08", "", map[string]string{"foo": "bar"}}

	js := job.NewJobState("loaded", "active", "listening", []string{}, &m1)
	js2 := job.NewJobState("loaded", "inactive", "dead", []string{}, &m2)
	js3 := job.NewJobState("loaded", "inactive", "dead", []string{}, &m2)
	js4 := job.NewJobState("loaded", "inactive", "dead", []string{}, &m3)

	states := map[string]*job.JobState{"pong.service": js, "hello.service": js2, "echo.service": js3, "private.service": js4}
	machines := []machine.MachineState{m1, m2, m3}

	registryCtl = BlockedTestRegistry{echoAttempts, TestRegistry{jobStates: states, machines: machines}}
}
Exemplo n.º 3
0
func translateUnitStatusEvents(changes map[string]*dbus.UnitStatus) []event.Event {
	events := make([]event.Event, 0)
	for key, status := range changes {
		jobName := key
		var state *job.JobState
		if status != nil {
			state = job.NewJobState(status.LoadState, status.ActiveState, status.SubState, nil, nil)
		}
		ev := event.Event{"EventJobStateUpdated", state, jobName}
		events = append(events, ev)
	}
	return events
}