Files
kubescape/core/pkg/hostsensorutils/hostsensormock.go
Frédéric BIDON a090a296fa refact(hostsensorutils): unexported fields that don't need to be exposed
Also:
* declared scanner resources as an enum type
* replaced stdlib json, added uit tests for skipped resources
* unexported worker pool
* more unexported methods (i.e. everything that is not part of the interface)
* refact(core): clarified mock injection logic and added a few unit tests at the caller's (CLI init utils)

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
2023-03-25 09:37:24 +01:00

34 lines
858 B
Go

package hostsensorutils
import (
"context"
"github.com/kubescape/opa-utils/objectsenvelopes/hostsensor"
"github.com/kubescape/opa-utils/reporthandling/apis"
)
// HostSensorHandlerMock is a noop sensor when the host scanner is disabled.
type HostSensorHandlerMock struct {
}
// NewHostSensorHandlerMock yields a dummy host sensor.
func NewHostSensorHandlerMock() *HostSensorHandlerMock {
return &HostSensorHandlerMock{}
}
func (hshm *HostSensorHandlerMock) Init(_ context.Context) error {
return nil
}
func (hshm *HostSensorHandlerMock) TearDown() error {
return nil
}
func (hshm *HostSensorHandlerMock) CollectResources(_ context.Context) ([]hostsensor.HostSensorDataEnvelope, map[string]apis.StatusInfo, error) {
return []hostsensor.HostSensorDataEnvelope{}, nil, nil
}
func (hshm *HostSensorHandlerMock) GetNamespace() string {
return ""
}