Skip to content

Commit

Permalink
Test without automated collector
Browse files Browse the repository at this point in the history
This code should be reverted once the timing logic has been sorted out.
See issue eraser-dev#568 for details.

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
  • Loading branch information
pmengelbert committed Dec 29, 2022
1 parent 59460e9 commit 7b49359
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
15 changes: 9 additions & 6 deletions controllers/imagecollector/imagecollector_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var (
collectorImage = flag.String("collector-image", "", "collector image, empty value disables collect feature")
log = logf.Log.WithName("controller").WithValues("process", "imagecollector-controller")
repeatPeriod = flag.Duration("repeat-period", time.Hour*24, "repeat period for collect/scan process")
repeatImmediate = flag.Bool("repeat-immediate", true, "begin collect/scan process immediately")
deleteScanFailedImages = flag.Bool("delete-scan-failed-images", true, "whether or not to delete images for which scanning has failed")
scannerArgs = utils.MultiFlag([]string{})
collectorArgs = utils.MultiFlag([]string{})
Expand Down Expand Up @@ -156,14 +157,16 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {

go func() {
log.Info("Queueing first ImageCollector reconcile...")
ch <- event.GenericEvent{
Object: &eraserv1alpha1.ImageJob{
ObjectMeta: metav1.ObjectMeta{
Name: "first-reconcile",
if *repeatImmediate {
ch <- event.GenericEvent{
Object: &eraserv1alpha1.ImageJob{
ObjectMeta: metav1.ObjectMeta{
Name: "first-reconcile",
},
},
},
}
log.Info("Queued first ImageCollector reconcile")
}
log.Info("Queued first ImageCollector reconcile")
}()

return nil
Expand Down
10 changes: 0 additions & 10 deletions test/e2e/tests/imagelist_rm_images/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ func TestImageListTriggersEraserImageJob(t *testing.T) {
t.Error("Failed to create the dep", err)
}

client := cfg.Client()
err := wait.For(
util.NumPodsPresentForLabel(ctx, client, 0, collectorLabel),
wait.WithTimeout(time.Minute*2),
wait.WithInterval(time.Millisecond*500),
)
if err != nil {
t.Fatal(err)
}

return ctx
}).
Assess("deployment successfully deployed", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
Expand Down
1 change: 1 addition & 0 deletions test/e2e/tests/imagelist_rm_images/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestMain(m *testing.M) {
"--set", util.EraserImageTag.Set(eraserImage.Tag),
"--set", util.ManagerImageRepo.Set(managerImage.Repo),
"--set", util.ManagerImageTag.Set(managerImage.Tag),
"--set", util.ManagerAdditionalArgs.Set("--repeat-immediate=false").String(),
),
).Finish(
envfuncs.DestroyKindCluster(util.KindClusterName),
Expand Down

0 comments on commit 7b49359

Please sign in to comment.