Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(oonimkall): log the events when testing #1624

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions pkg/oonimkall/taskrunner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ func TestTaskRunnerRun(t *testing.T) {

// reduceEventsKeysIgnoreLog reduces the list of event keys
// counting equal subsequent keys and ignoring log events
reduceEventsKeysIgnoreLog := func(events []*event) (out []eventKeyCount) {
reduceEventsKeysIgnoreLog := func(t *testing.T, events []*event) (out []eventKeyCount) {
var current eventKeyCount
for _, ev := range events {
t.Log(ev)
if ev.Key == eventTypeLog {
continue
}
Expand Down Expand Up @@ -303,7 +304,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand All @@ -321,7 +322,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand All @@ -339,7 +340,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand All @@ -361,7 +362,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand All @@ -382,7 +383,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand All @@ -405,7 +406,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand All @@ -427,7 +428,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand All @@ -448,7 +449,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand All @@ -469,7 +470,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand Down Expand Up @@ -498,7 +499,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand Down Expand Up @@ -531,7 +532,7 @@ func TestTaskRunnerRun(t *testing.T) {
"architecture": "arm64",
}
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand All @@ -556,7 +557,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand Down Expand Up @@ -604,7 +605,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand Down Expand Up @@ -651,7 +652,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand Down Expand Up @@ -681,7 +682,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand Down Expand Up @@ -721,7 +722,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand Down Expand Up @@ -766,7 +767,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollectContext(ctx, runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand Down Expand Up @@ -796,7 +797,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand Down Expand Up @@ -830,7 +831,7 @@ func TestTaskRunnerRun(t *testing.T) {
}
runner.newSession = fake.NewSession
events := runAndCollect(runner, emitter)
reduced := reduceEventsKeysIgnoreLog(events)
reduced := reduceEventsKeysIgnoreLog(t, events)
expect := []eventKeyCount{
{Key: eventTypeStatusQueued, Count: 1},
{Key: eventTypeStatusStarted, Count: 1},
Expand Down
Loading