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

Fix hive test argument order and race #25545

Merged
merged 2 commits into from
May 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkg/hive/hive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func TestHiveGoodConfig(t *testing.T) {
err = hive.Stop(context.TODO())
assert.NoError(t, err, "expected Stop to succeed")

assert.Equal(t, cfg.Foo, "test", "Config.Foo not set correctly")
assert.Equal(t, cfg.Bar, 13, "Config.Bar not set correctly")
assert.Equal(t, "test", cfg.Foo, "Config.Foo not set correctly")
assert.Equal(t, 13, cfg.Bar, "Config.Bar not set correctly")
}

// BadConfig has a field that matches no flags, and Flags
Expand Down Expand Up @@ -104,7 +104,7 @@ func TestHiveConfigOverride(t *testing.T) {
err = h.Stop(context.TODO())
assert.NoError(t, err, "expected Stop to succeed")

assert.Equal(t, cfg.Foo, "override", "Config.Foo not set correctly")
assert.Equal(t, "override", cfg.Foo, "Config.Foo not set correctly")
}

type SomeObject struct {
Expand Down Expand Up @@ -302,15 +302,15 @@ func TestRunRollback(t *testing.T) {
})
}),
)
h.SetTimeouts(time.Millisecond, time.Millisecond)
h.SetTimeouts(time.Millisecond, time.Minute)

err := h.Run()
assert.ErrorIs(t, err, context.DeadlineExceeded, "expected Run() to fail with timeout")

// We should see 2 start hooks invoked, and then 1 stop hook as first
// one is rolled back.
assert.Equal(t, started, 2)
assert.Equal(t, stopped, 1)
assert.Equal(t, 2, started)
assert.Equal(t, 1, stopped)
}

var shutdownOnStartCell = cell.Invoke(func(lc hive.Lifecycle, shutdowner hive.Shutdowner) {
Expand Down