Skip to content

Commit

Permalink
Merge pull request #1309 from marquiz/devel/refactor-gc-3
Browse files Browse the repository at this point in the history
topology-gc: rename run()
  • Loading branch information
k8s-ci-robot committed Aug 18, 2023
2 parents b47667f + 98b0b36 commit f4cf487
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/nfd-topology-gc/nfd-nrt-gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (n *topologyGC) periodicGC(gcPeriod time.Duration) {
}
}

func (n *topologyGC) run() error {
func (n *topologyGC) startNodeInformer() error {
nodeInformer := n.factory.Core().V1().Nodes().Informer()

if _, err := nodeInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
Expand All @@ -178,7 +178,7 @@ func (n *topologyGC) run() error {

// Run is a blocking function that removes stale NRT objects when Node is deleted and runs periodic GC to make sure any obsolete objects are removed
func (n *topologyGC) Run() error {
if err := n.run(); err != nil {
if err := n.startNodeInformer(); err != nil {
return err
}
// run periodic GC
Expand Down
8 changes: 4 additions & 4 deletions pkg/nfd-topology-gc/nfd-nrt-gc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestNRTGC(t *testing.T) {
gcPeriod: 10 * time.Minute,
}

err := gc.run()
err := gc.startNodeInformer()
So(err, ShouldBeNil)

nrts, err := fakeClient.TopologyV1alpha2().NodeResourceTopologies().List(context.TODO(), metav1.ListOptions{})
Expand Down Expand Up @@ -90,7 +90,7 @@ func TestNRTGC(t *testing.T) {
gcPeriod: 10 * time.Minute,
}

err := gc.run()
err := gc.startNodeInformer()
So(err, ShouldBeNil)

nrts, err := fakeClient.TopologyV1alpha2().NodeResourceTopologies().List(context.TODO(), metav1.ListOptions{})
Expand Down Expand Up @@ -136,7 +136,7 @@ func TestNRTGC(t *testing.T) {
gcPeriod: 10 * time.Minute,
}

err := gc.run()
err := gc.startNodeInformer()
So(err, ShouldBeNil)

nrts, err := fakeClient.TopologyV1alpha2().NodeResourceTopologies().List(context.TODO(), metav1.ListOptions{})
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestNRTGC(t *testing.T) {
gcPeriod: time.Second,
}

err := gc.run()
err := gc.startNodeInformer()
So(err, ShouldBeNil)

nrts, err := fakeClient.TopologyV1alpha2().NodeResourceTopologies().List(context.TODO(), metav1.ListOptions{})
Expand Down

0 comments on commit f4cf487

Please sign in to comment.