Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro committed Mar 2, 2024
1 parent df2fdd4 commit 4057c9d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/app/system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ func TestSystem_TestProcListShutsDownInOrder(t *testing.T) {
TimestampFormat: "",
NoMetadata: true,
FlushEachLine: true,
NoColor: true,
}
go runner.Run()
time.Sleep(10 * time.Millisecond)
Expand All @@ -469,20 +470,20 @@ func TestSystem_TestProcListShutsDownInOrder(t *testing.T) {
t.Errorf(err.Error())
return
}
states, err = runner.GetProcessesState()
if err != nil {
t.Errorf(err.Error())
return
}
runningProcesses := 0
for _, proc := range runner.runningProcesses {
processState, err := runner.GetProcessState(proc.getName())
if err != nil {
t.Errorf(err.Error())
return
}
for _, processState := range states.States {
if processState.IsRunning {
runningProcesses++
}
}
want = 0
if runningProcesses != want {
t.Errorf("len(runner.runningProcesses) = %d, want %d", len(runner.runningProcesses), want)
t.Errorf("runningProcesses = %d, want %d", runningProcesses, want)
}
//read file and validate the shutdown order
scanner := bufio.NewScanner(file)
Expand All @@ -494,7 +495,7 @@ func TestSystem_TestProcListShutsDownInOrder(t *testing.T) {
}
}
wantOrder := []string{"C: exit", "B: exit", "A: exit"}
if !slices.Equal(wantOrder, order) {
if !slices.Equal(order, wantOrder) {
t.Errorf("content = %v, want %v", order, wantOrder)
return
}
Expand Down

0 comments on commit 4057c9d

Please sign in to comment.