@@ -1578,7 +1578,7 @@ func TestExternalClusterNaming(t *testing.T) {
15781578
15791579func (s * DeploymentHandlerSuite ) TestGarbageCollection_RunsAfterSuccessfulScan () {
15801580 gcCalled := false
1581- d := s .createDeploymentHandlerWithGCMock (func (ctx context.Context , req * mondooclient.DeleteAssetsRequest ) error {
1581+ d := s .createDeploymentHandlerWithGCMock (func (ctx context.Context , req * mondooclient.GarbageCollectAssetsRequest ) error {
15821582 gcCalled = true
15831583 s .Equal ("k8s-cluster" , req .PlatformRuntime )
15841584 s .Contains (req .ManagedBy , "mondoo-operator-" )
@@ -1609,13 +1609,13 @@ func (s *DeploymentHandlerSuite) TestGarbageCollection_RunsAfterSuccessfulScan()
16091609 s .NoError (err )
16101610 s .True (result .IsZero ())
16111611
1612- s .True (gcCalled , "DeleteAssets should have been called" )
1612+ s .True (gcCalled , "GarbageCollectAssets should have been called" )
16131613 s .NotNil (d .Mondoo .Status .LastK8sResourceGarbageCollectionTime , "GC timestamp should be set in status" )
16141614}
16151615
16161616func (s * DeploymentHandlerSuite ) TestGarbageCollection_SkipsWhenAlreadyRun () {
16171617 gcCalled := false
1618- d := s .createDeploymentHandlerWithGCMock (func (ctx context.Context , opts * mondooclient.DeleteAssetsRequest ) error {
1618+ d := s .createDeploymentHandlerWithGCMock (func (ctx context.Context , opts * mondooclient.GarbageCollectAssetsRequest ) error {
16191619 gcCalled = true
16201620 return nil
16211621 })
@@ -1644,11 +1644,11 @@ func (s *DeploymentHandlerSuite) TestGarbageCollection_SkipsWhenAlreadyRun() {
16441644 s .NoError (err )
16451645 s .True (result .IsZero ())
16461646
1647- s .False (gcCalled , "DeleteAssets should NOT have been called" )
1647+ s .False (gcCalled , "GarbageCollectAssets should NOT have been called" )
16481648}
16491649
16501650func (s * DeploymentHandlerSuite ) TestGarbageCollection_FailureStillUpdatesTimestamp () {
1651- d := s .createDeploymentHandlerWithGCMock (func (ctx context.Context , opts * mondooclient.DeleteAssetsRequest ) error {
1651+ d := s .createDeploymentHandlerWithGCMock (func (ctx context.Context , opts * mondooclient.GarbageCollectAssetsRequest ) error {
16521652 return fmt .Errorf ("API error" )
16531653 })
16541654 s .NoError (d .KubeClient .Create (s .ctx , & s .auditConfig ))
@@ -1677,8 +1677,8 @@ func (s *DeploymentHandlerSuite) TestGarbageCollection_FailureStillUpdatesTimest
16771677}
16781678
16791679// createDeploymentHandlerWithGCMock creates a DeploymentHandler with a mock MondooClientBuilder
1680- // that captures calls to DeleteAssets .
1681- func (s * DeploymentHandlerSuite ) createDeploymentHandlerWithGCMock (gcFunc func (context.Context , * mondooclient.DeleteAssetsRequest ) error ) DeploymentHandler {
1680+ // that captures calls to GarbageCollectAssets .
1681+ func (s * DeploymentHandlerSuite ) createDeploymentHandlerWithGCMock (gcFunc func (context.Context , * mondooclient.GarbageCollectAssetsRequest ) error ) DeploymentHandler {
16821682 // Create a mock credentials secret so GC can read it
16831683 key := credentials .MondooServiceAccount (s .T ())
16841684 mockSA := mondooclient.ServiceAccountCredentials {
@@ -1713,14 +1713,14 @@ func (s *DeploymentHandlerSuite) createDeploymentHandlerWithGCMock(gcFunc func(c
17131713// fakeMondooClient implements just enough of MondooClient to test GC
17141714type fakeMondooClient struct {
17151715 mondooclient.MondooClient
1716- gcFunc func (context.Context , * mondooclient.DeleteAssetsRequest ) error
1716+ gcFunc func (context.Context , * mondooclient.GarbageCollectAssetsRequest ) error
17171717}
17181718
1719- func (f * fakeMondooClient ) DeleteAssets (ctx context.Context , req * mondooclient.DeleteAssetsRequest ) ( * mondooclient. DeleteAssetsConfirmation , error ) {
1719+ func (f * fakeMondooClient ) GarbageCollectAssets (ctx context.Context , req * mondooclient.GarbageCollectAssetsRequest ) error {
17201720 if f .gcFunc != nil {
1721- return & mondooclient. DeleteAssetsConfirmation {}, f .gcFunc (ctx , req )
1721+ return f .gcFunc (ctx , req )
17221722 }
1723- return & mondooclient. DeleteAssetsConfirmation {}, nil
1723+ return nil
17241724}
17251725
17261726func TestDeploymentHandlerSuite (t * testing.T ) {
0 commit comments