Skip to content

Commit ff4a73e

Browse files
david-yuclaude
andcommitted
rpk: fix $HOME-unset failures in OAUTHBEARER tests
config.Params.Load calls os.UserConfigDir, which requires $HOME to be set. The Bazel sandbox does not set it. Add t.Setenv("HOME", "/") to the loadProfile helpers so both `bazel test` and plain `go test` work. Also add size="small" to the two new go_test targets; the default MODERATE size was causing spurious Bazel warnings for sub-millisecond tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit 9a73bbb)
1 parent 8c866da commit ff4a73e

4 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/go/rpk/pkg/kafka/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ go_library(
2424

2525
go_test(
2626
name = "kafka_test",
27+
size = "small",
2728
srcs = ["client_franz_test.go"],
2829
embed = [":kafka"],
2930
deps = [

src/go/rpk/pkg/kafka/client_franz_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
// through the config system so internal fields are populated.
2222
func loadProfile(t *testing.T, fs afero.Fs, p *config.RpkProfile) *config.RpkProfile {
2323
t.Helper()
24+
t.Setenv("HOME", "/")
2425
p.Name = "test"
2526
rpkyaml := config.RpkYaml{
2627
CurrentProfile: "test",

src/go/rpk/pkg/schemaregistry/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ go_library(
2424

2525
go_test(
2626
name = "schemaregistry_test",
27+
size = "small",
2728
srcs = [
2829
"client_test.go",
2930
"context_test.go",

src/go/rpk/pkg/schemaregistry/client_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
// through the config system so internal fields are populated.
2222
func loadProfile(t *testing.T, fs afero.Fs, p *config.RpkProfile) *config.RpkProfile {
2323
t.Helper()
24+
t.Setenv("HOME", "/")
2425
p.Name = "test"
2526
rpkyaml := config.RpkYaml{
2627
CurrentProfile: "test",

0 commit comments

Comments
 (0)