Skip to content

Commit 173152b

Browse files
committed
e2e: fixture: use explicit context
the fact it was implicit was an implementation accident we can now rectify. Signed-off-by: Francesco Romani <fromani@redhat.com>
1 parent 682ace0 commit 173152b

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

test/e2e/serial/config/fixture.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,37 +64,37 @@ var Config *E2EConfig
6464

6565
func SetupFixture() error {
6666
var err error
67-
Config, err = NewFixtureWithOptions("e2e-test-infra", e2efixture.OptionRandomizeName|e2efixture.OptionAvoidCooldown|e2efixture.OptionStaticClusterData)
67+
Config, err = NewFixtureWithOptions(context.Background(), "e2e-test-infra", e2efixture.OptionRandomizeName|e2efixture.OptionAvoidCooldown|e2efixture.OptionStaticClusterData)
6868
return err
6969
}
7070

7171
func TeardownFixture() error {
7272
return e2efixture.Teardown(Config.Fixture)
7373
}
7474

75-
func NewFixtureWithOptions(nsName string, options e2efixture.Options) (*E2EConfig, error) {
75+
func NewFixtureWithOptions(ctx context.Context, nsName string, options e2efixture.Options) (*E2EConfig, error) {
7676
var err error
7777
cfg := E2EConfig{
7878
NROOperObj: &nropv1.NUMAResourcesOperator{},
7979
NROSchedObj: &nropv1.NUMAResourcesScheduler{},
8080
}
8181

82-
cfg.Fixture, err = e2efixture.SetupWithOptions(nsName, nrtv1alpha2.NodeResourceTopologyList{}, options)
82+
cfg.Fixture, err = e2efixture.SetupWithOptions(ctx, nsName, nrtv1alpha2.NodeResourceTopologyList{}, options)
8383
if err != nil {
8484
return nil, err
8585
}
8686

87-
err = cfg.Fixture.Client.List(context.TODO(), &cfg.infraNRTList)
87+
err = cfg.Fixture.Client.List(ctx, &cfg.infraNRTList)
8888
if err != nil {
8989
return nil, err
9090
}
9191

92-
err = cfg.Fixture.Client.Get(context.TODO(), objects.NROObjectKey(), cfg.NROOperObj)
92+
err = cfg.Fixture.Client.Get(ctx, objects.NROObjectKey(), cfg.NROOperObj)
9393
if err != nil {
9494
return nil, err
9595
}
9696

97-
err = cfg.Fixture.Client.Get(context.TODO(), objects.NROSchedObjectKey(), cfg.NROSchedObj)
97+
err = cfg.Fixture.Client.Get(ctx, objects.NROSchedObjectKey(), cfg.NROSchedObj)
9898
if err != nil {
9999
return nil, err
100100
}

test/internal/fixture/fixture.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ func init() {
9999
cooldownThreshold = getCooldownThresholdFromEnvVar()
100100
}
101101

102-
func SetupWithOptions(name string, nrtList nrtv1alpha2.NodeResourceTopologyList, options Options) (*Fixture, error) {
103-
ctx := context.Background()
102+
func SetupWithOptions(ctx context.Context, name string, nrtList nrtv1alpha2.NodeResourceTopologyList, options Options) (*Fixture, error) {
104103
if !e2eclient.ClientsEnabled {
105104
return nil, fmt.Errorf("clients not enabled")
106105
}
@@ -191,7 +190,7 @@ func SetupWithOptions(name string, nrtList nrtv1alpha2.NodeResourceTopologyList,
191190
}
192191

193192
func Setup(baseName string, nrtList nrtv1alpha2.NodeResourceTopologyList) (*Fixture, error) {
194-
return SetupWithOptions(baseName, nrtList, OptionRandomizeName)
193+
return SetupWithOptions(context.Background(), baseName, nrtList, OptionRandomizeName)
195194
}
196195

197196
func Teardown(ft *Fixture) error {

0 commit comments

Comments
 (0)