Exemplo n.º 1
0
func TestOneLineOutput(t *testing.T) {
	defer cleanupLogsDir()
	// create and start a process
	p := startAndWaitTestProcess("echo test", t)

	logs, _ := process.ReadAllLogs(p.Pid)

	if len(logs) != 1 {
		t.Fatalf("Expected logs size to be 1, but got %d", len(logs))
	}

	if logs[0].Text != "test" {
		t.Fatalf("Expected to get 'test' output but got %s", logs[0].Text)
	}
}
Exemplo n.º 2
0
func TestEmptyLinesOutput(t *testing.T) {
	defer cleanupLogsDir()
	p := startAndWaitTestProcess("printf \"\n\n\n\n\n\"", t)

	logs, _ := process.ReadAllLogs(p.Pid)

	if len(logs) != 5 {
		t.Fatal("Expected logs to be 4 sized")
	}

	for _, value := range logs {
		if value.Text != "" {
			t.Fatal("Expected all the logs to be empty files")
		}
	}
}