Skip to content

Commit

Permalink
matcher: add Initialized method
Browse files Browse the repository at this point in the history
This exposes an underlying change in the claircore packages.

Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Mar 23, 2021
1 parent e9390fa commit 858c540
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions httptransport/client/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,9 @@ func (c *HTTP) UpdateDiff(ctx context.Context, prev, cur uuid.UUID) (*driver.Upd
}
return &d, nil
}

// Initialized is present to fulfill the interface, but isn't exposed as part of
// the HTTP API. This method is stubbed out.
func (c *HTTP) Initialized(_ context.Context) (bool, error) {
return true, nil
}
8 changes: 8 additions & 0 deletions matcher/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Mock struct {
LatestUpdateOperations_ func(context.Context) (map[string][]driver.UpdateOperation, error)
UpdateDiff_ func(context.Context, uuid.UUID, uuid.UUID) (*driver.UpdateDiff, error)
Scan_ func(context.Context, *claircore.IndexReport) (*claircore.VulnerabilityReport, error)
Initialized_ func(context.Context) (bool, error)
// TestUOs provide memory for the mock.
// usage of this field can be dictated by the test case's needs.
sync.Mutex
Expand Down Expand Up @@ -77,3 +78,10 @@ func (d *Mock) Scan(ctx context.Context, ir *claircore.IndexReport) (*claircore.
}
return d.Scan_(ctx, ir)
}

func (d *Mock) Initialized(ctx context.Context) (bool, error) {
if d.Initialized_ == nil {
panic("mock matcher: unexpected call to Initialized")
}
return d.Initialized_(ctx)
}
1 change: 1 addition & 0 deletions matcher/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Service interface {

// Scanner is an interface providing a claircore.VulnerabilityReport given a claircore.IndexReport
type Scanner interface {
Initialized(context.Context) (bool, error)
Scan(ctx context.Context, ir *claircore.IndexReport) (*claircore.VulnerabilityReport, error)
}

Expand Down

0 comments on commit 858c540

Please sign in to comment.