Skip to content

Commit

Permalink
cec: add unit test for reconciler
Browse files Browse the repository at this point in the history
This commit introduces unit-tests for the new reconciliation logic.

Signed-off-by: Marco Hofstetter <[email protected]>
  • Loading branch information
mhofstetter authored and lmb committed Feb 8, 2024
1 parent c7e2960 commit f44e000
Show file tree
Hide file tree
Showing 2 changed files with 697 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/ciliumenvoyconfig/cec_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ type ciliumEnvoyConfigReconciler struct {
}

type config struct {
meta metav1.ObjectMeta
spec *ciliumv2.CiliumEnvoyConfigSpec
meta metav1.ObjectMeta
spec *ciliumv2.CiliumEnvoyConfigSpec
// Keeping the state whether the config matched as dedicated field.
// This is only used when checking whether an existing config selected
// the local node. (instead of re-evaluating using the node selector)
selectsLocalNode bool
}

Expand Down Expand Up @@ -172,7 +175,7 @@ func (r *ciliumEnvoyConfigReconciler) configUpsertedInternal(ctx context.Context
scopedLogger.Debug("New config doesn't select the local Node")

case !isApplied && selectsLocalNode:
scopedLogger.Debug("New onfig selects the local node - adding config")
scopedLogger.Debug("New config selects the local node - adding config")
if err := r.manager.addCiliumEnvoyConfig(cfg.meta, cfg.spec); err != nil {
return err
}
Expand Down
Loading

0 comments on commit f44e000

Please sign in to comment.