Beispiel #1
0
func TestStop(t *testing.T) {

	cfg, err := setup(FILE)
	if err != nil {
		t.Fatal(err)
	}

	s := service.NewLisaService(cfg)
	done := make(chan bool)
	go func() {
		done <- run(s)
	}()

	stop <- syscall.SIGINT

	timeout := time.After(time.Millisecond * 10)
	select {
	case <-timeout:
		t.Error("Timed out waiting for service to stop.")
	case ok := <-done:
		if !ok {
			t.Errorf("Expected true, got %b", ok)
		}
	}
}
Beispiel #2
0
func main() {

	cfg, err := setup(FILE)
	if err != nil {
		panic(err)
	}

	log.Printf("config file %s loaded.", FILE)

	s := service.NewLisaService(cfg)

	run(s)

}