Skip to content

Takeover e2e tests#1141

Open
faizanahmad055 wants to merge 30 commits into
masterfrom
takeover-e2e-tests
Open

Takeover e2e tests#1141
faizanahmad055 wants to merge 30 commits into
masterfrom
takeover-e2e-tests

Conversation

@faizanahmad055
Copy link
Copy Markdown
Contributor

Takeover from 1081

This PR introduces a complete overhaul of the e2e testing infrastructure, replacing the previous test approach with a modern, maintainable, and faster test suite built on Ginkgo v2

Key Changes

Test Framework Migration

  • Migrated from custom test setup to Ginkgo v2 with Gomega matchers
  • Organized tests into logical suites: core, annotations, flags, advanced, csi, argo
  • ~90 test specs with ~180 table-driven entries covering all workload types and scenarios

Runtime Image Building

  • Tests build the Reloader image at runtime from the current codebase (make e2e)
  • Image automatically loaded into Kind cluster before test execution and decouples the code-base from e2e tests

Real Infrastructure Integration

  • Real Vault: Tests run against an actual HashiCorp Vault instance, not mocks
  • Real CSI Secrets Store Driver: Actual secrets-store-csi-driver with Vault provider
  • Real Argo Rollouts: Actual Argo Rollouts controller for Rollout workload testing
  • CSI tests create secrets in Vault, verify SecretProviderClass sync, and validate Reloader triggers rolling updates on secret rotation
  • All versions pinned for reproducibility (Vault 1.20.4, CSI Driver 1.5.5, Argo Rollouts 1.7.2)

Watch-Based Waiting Infrastructure

  • Replaced all time.Sleep() and polling-based waits with Kubernetes watch API
  • Generic WatchUntil[T runtime.Object] function for type-safe resource watching
  • Condition functions (DeploymentReady, DaemonSetReady, etc.) for clean assertions
  • Tests react to actual state changes instead of arbitrary timeouts - faster and more reliable

Workload Adapter Pattern

  • Unified WorkloadAdapter interface for all workload types
  • Supports: Deployment, DaemonSet, StatefulSet, Job, CronJob, Argo Rollout, OpenShift DeploymentConfig
  • Capability interfaces (Pausable, Recreatable, JobTriggerer) for workload-specific features
  • Single test code works across all workload types via table-driven tests

Test Coverage

Category What's Tested
Core Workloads ConfigMap/Secret reload via volumes, envFrom, env valueFrom for all 7 workload types
Annotations auto=true, typed auto (configmap.auto, secret.auto, secretproviderclass.auto), search/match, exclude, pause-period
Flags --watch-globally, --namespaces-to-ignore, --resources-to-ignore, --reload-on-create, --reload-on-delete, --auto-reload-all
CSI Integration Real Vault secret creation/rotation, SecretProviderClass sync, SPCPS version tracking, automatic reload on external secret changes
Advanced Job recreation, CronJob triggered jobs, multi-container pods, init containers, regex matching
Strategies Annotations strategy and env-vars strategy (STAKATER_* environment variables)

Infrastructure Scripts

  • scripts/e2e-cluster-setup.sh - Installs Argo Rollouts, CSI Secrets Store Driver, Vault (with Kubernetes auth configured)
  • scripts/e2e-cluster-cleanup.sh - Cleans up test resources
  • Makefile targets: make e2e-setup, make e2e, make e2e-cleanup, make e2e-ci

Code Quality

  • Added .golangci.yml with comprehensive linter configuration (errcheck, govet, staticcheck, ginkgolinter, etc.)
  • All e2e utility code passes lint checks
  • Unit tests for utility functions (annotations, helm, rand, test helpers)

List of all tests

advanced/job_reload_test.go

  • Job Workload Recreation Tests Job with auto annotation should recreate Job with auto=true when ConfigMap changes — Job
  • Job Workload Recreation Tests Job with ConfigMap reference should recreate Job when referenced ConfigMap changes — Job
  • Job Workload Recreation Tests Job with SecretProviderClass reference should recreate Job when Vault secret changes — Job
  • Job Workload Recreation Tests Job with Secret reference should recreate Job when referenced Secret changes — Job
  • Job Workload Recreation Tests Job with valueFrom ConfigMap reference should recreate Job when ConfigMap referenced via valueFrom changes — Job
  • Job Workload Recreation Tests Job with valueFrom Secret reference should recreate Job when Secret referenced via valueFrom changes — Job

advanced/multi_container_test.go

  • Multi-Container Tests Init container with CSI volume should reload when SecretProviderClassPodStatus used by init container changes
  • Multi-Container Tests Init container with CSI volume should reload with auto annotation when init container CSI volume changes
  • Multi-Container Tests Multiple containers different ConfigMaps should reload when any container's ConfigMap changes
  • Multi-Container Tests Multiple containers same ConfigMap should reload when ConfigMap used by multiple containers changes

advanced/regex_test.go

  • Regex Pattern Tests ConfigMap regex pattern should NOT reload when ConfigMap NOT matching pattern changes
  • Regex Pattern Tests ConfigMap regex pattern should reload when ConfigMap matching pattern changes
  • Regex Pattern Tests Secret regex pattern should reload when Secret matching pattern changes

annotations/auto_reload_test.go

  • Auto Reload Annotation Tests with auto annotation and explicit reload annotation together should reload when auto-detected resource changes
  • Auto Reload Annotation Tests with reloader.stakater.com/auto=true annotation should reload Deployment when any referenced ConfigMap changes — Deployment
  • Auto Reload Annotation Tests with reloader.stakater.com/auto=true annotation should reload Deployment when any referenced Secret changes — Deployment
  • Auto Reload Annotation Tests with reloader.stakater.com/auto=true annotation should reload Deployment when either ConfigMap or Secret changes — Deployment
  • Auto Reload Annotation Tests with secretproviderclass.reloader.stakater.com/auto=true annotation should NOT reload Deployment when ConfigMap changes (only SPC auto enabled) — Deployment
  • Auto Reload Annotation Tests with secretproviderclass.reloader.stakater.com/auto=true annotation should reload Deployment when SecretProviderClassPodStatus changes — Deployment
  • Auto Reload Annotation Tests with secretproviderclass.reloader.stakater.com/auto=true annotation should reload when using combined auto=true annotation for SPC

annotations/combination_test.go

  • Combination Annotation Tests auto=true with exclude annotations should NOT reload when excluded ConfigMap changes
  • Combination Annotation Tests auto=true with exclude annotations should NOT reload when excluded Secret changes
  • Combination Annotation Tests auto=true with exclude annotations should reload when non-excluded ConfigMap changes
  • Combination Annotation Tests auto=true with explicit reload annotations should reload when both auto-detected and explicitly listed ConfigMaps change
  • Combination Annotation Tests auto=true with explicit reload annotations should reload when explicitly listed ConfigMap changes with auto=true
  • Combination Annotation Tests auto=true with explicit reload annotations should reload when Secret changes with auto=true and explicit Secret annotation
  • Combination Annotation Tests multiple explicit references should reload when any of multiple explicitly listed ConfigMaps change
  • Combination Annotation Tests multiple explicit references should reload when any of multiple explicitly listed Secrets change
  • Combination Annotation Tests multiple explicit references should reload when both ConfigMap and Secret annotations are present

annotations/exclude_test.go

  • Exclude Annotation Tests ConfigMap exclude annotation should NOT reload when excluded ConfigMap changes
  • Exclude Annotation Tests ConfigMap exclude annotation should reload when non-excluded ConfigMap changes
  • Exclude Annotation Tests Exclude annotation on pod template — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Exclude Annotation Tests Secret exclude annotation should NOT reload when excluded Secret changes
  • Exclude Annotation Tests Secret exclude annotation should reload when non-excluded Secret changes
  • Exclude Annotation Tests SecretProviderClass exclude annotation should NOT reload when excluded SecretProviderClassPodStatus changes
  • Exclude Annotation Tests SecretProviderClass exclude annotation should reload when non-excluded SecretProviderClassPodStatus changes

annotations/pause_period_test.go

  • Pause Period Tests with pause-period annotation should NOT pause Deployment without pause-period annotation — Deployment
  • Pause Period Tests with pause-period annotation should pause Deployment after reload — Deployment
  • [PENDING] Pause Period Tests with pause-period annotation should pause Deployment when pause-period annotation is on pod template — Deployment

annotations/resource_ignore_test.go

  • Resource Ignore Annotation Tests with reloader.stakater.com/ignore annotation on resource should NOT reload when ConfigMap has ignore=true annotation
  • Resource Ignore Annotation Tests with reloader.stakater.com/ignore annotation on resource should NOT reload when Secret has ignore=true annotation

annotations/search_match_test.go

  • Search and Match Annotation Tests with search and match annotations should NOT reload when resource has match but no Deployment has search — Deployment
  • Search and Match Annotation Tests with search and match annotations should NOT reload when workload has search but ConfigMap has no match
  • Search and Match Annotation Tests with search and match annotations should reload only the deployment with search annotation when multiple deployments use same ConfigMap — Deployment
  • Search and Match Annotation Tests with search and match annotations should reload when workload has search annotation and ConfigMap has match annotation
  • Search and Match Annotation Tests with search annotation on pod template — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig

argo/rollout_test.go

  • Argo Rollout Strategy Tests Rollout strategy annotation should use default rollout strategy (annotation-based reload) — ArgoRollout
  • Argo Rollout Strategy Tests Rollout strategy annotation should use restart strategy when specified (sets restartAt field) — ArgoRollout

core/reference_methods_test.go

  • Reference Method Tests Auto Annotation with valueFrom should reload with auto=true when ConfigMap referenced via valueFrom changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Reference Method Tests Init Container with envFrom should reload when ConfigMap referenced by init container changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Reference Method Tests Init Container with envFrom should reload when Secret referenced by init container changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Reference Method Tests Init Container with Volume Mount should reload when ConfigMap volume mounted in init container changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Reference Method Tests Init Container with Volume Mount should reload when Secret volume mounted in init container changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Reference Method Tests Projected Volumes should reload when ConfigMap changes in mixed projected volume — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Reference Method Tests Projected Volumes should reload when ConfigMap in projected volume changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Reference Method Tests Projected Volumes should reload when Secret changes in mixed projected volume — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Reference Method Tests Projected Volumes should reload when Secret in projected volume changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Reference Method Tests valueFrom.configMapKeyRef should reload when ConfigMap referenced via valueFrom.configMapKeyRef changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Reference Method Tests valueFrom.secretKeyRef should reload when Secret referenced via valueFrom.secretKeyRef changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig

core/workloads_test.go

  • Workload Reload Tests Annotations Strategy should NOT reload when only ConfigMap labels change (no data change) — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Annotations Strategy should NOT reload when only Secret labels change (no data change) — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Annotations Strategy should NOT reload when only SecretProviderClassPodStatus labels change — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Annotations Strategy should reload when ConfigMap changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Annotations Strategy should reload when Secret changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Annotations Strategy should reload when SecretProviderClassPodStatus changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Annotations Strategy should reload with auto=true annotation when ConfigMap changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests CronJob (special handling) should NOT reload without Reloader annotation — Deployment, DaemonSet, StatefulSet
  • Workload Reload Tests CronJob (special handling) should reload when volume-mounted ConfigMap changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests CronJob (special handling) should reload when volume-mounted Secret changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests CronJob (special handling) should trigger a Job when ConfigMap changes — CronJob
  • Workload Reload Tests CronJob (special handling) should trigger a Job when Secret changes — CronJob
  • Workload Reload Tests CronJob (special handling) should trigger a Job with auto=true annotation when ConfigMap changes — CronJob
  • Workload Reload Tests Edge Cases should NOT reload with auto=false annotation — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Edge Cases should reload multiple times for sequential ConfigMap updates — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Edge Cases should reload when either ConfigMap or Secret changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Edge Cases should reload with multiple ConfigMaps when any one changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Edge Cases should reload with multiple Secrets when any one changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests EnvVars Strategy should add STAKATER_ env var when ConfigMap changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests EnvVars Strategy should add STAKATER_ env var when Secret changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests EnvVars Strategy should add STAKATER_ env var when SecretProviderClassPodStatus changes — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests EnvVars Strategy should add STAKATER_ env var when SecretProviderClassPodStatus used by init container changes
  • Workload Reload Tests EnvVars Strategy should add STAKATER_ env var with secretproviderclass auto annotation
  • Workload Reload Tests EnvVars Strategy should NOT add STAKATER_ env var when excluded SecretProviderClassPodStatus changes
  • Workload Reload Tests EnvVars Strategy should NOT add STAKATER_ env var when only ConfigMap labels change — Deployment, DaemonSet, StatefulSet
  • Workload Reload Tests EnvVars Strategy should NOT add STAKATER_ env var when only Secret labels change — Deployment, DaemonSet, StatefulSet
  • Workload Reload Tests EnvVars Strategy should NOT add STAKATER_ env var when only SecretProviderClassPodStatus labels change — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Pod Template Annotations should NOT reload when pod template has ConfigMap annotation but Secret is updated — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Pod Template Annotations should reload when annotations are on both workload and pod template — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Pod Template Annotations should reload when auto=true annotation is on pod template only — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Pod Template Annotations should reload when ConfigMap annotation is on pod template only — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Pod Template Annotations should reload when Secret annotation is on pod template only — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Pod Template Annotations should reload when SecretProviderClass annotation is on pod template only — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig
  • Workload Reload Tests Pod Template Annotations should reload when secretproviderclass auto annotation is on pod template only — Deployment, DaemonSet, StatefulSet, ArgoRollout, DeploymentConfig

csi/csi_test.go

  • CSI SecretProviderClass Tests Real Vault Integration Tests should handle multiple Vault secret updates
  • CSI SecretProviderClass Tests Real Vault Integration Tests should reload when Vault secret changes
  • CSI SecretProviderClass Tests Typed Auto Annotation Tests should reload for both ConfigMap and SPC when using combined auto=true

flags/auto_reload_all_test.go

  • Auto Reload All Flag Tests with autoReloadAll=true flag should reload workloads without any annotations when autoReloadAll is true
  • Auto Reload All Flag Tests with autoReloadAll=true flag should respect auto=false annotation even when autoReloadAll is true

flags/ignored_workloads_test.go

  • Ignored Workloads Flag Tests with both ignoreCronJobs=true and ignoreJobs=true flags should NOT reload CronJobs when both job flags are true — CronJob
  • Ignored Workloads Flag Tests with ignoreCronJobs=true flag should NOT reload CronJobs when ignoreCronJobs=true — CronJob
  • Ignored Workloads Flag Tests with ignoreCronJobs=true flag should still reload Deployments when ignoreCronJobs=true — CronJob

flags/ignore_resources_test.go

  • Ignore Resources Flag Tests with ignoreConfigMaps=true flag should NOT reload when ConfigMap changes with ignoreConfigMaps=true
  • Ignore Resources Flag Tests with ignoreConfigMaps=true flag should still reload when Secret changes with ignoreConfigMaps=true
  • Ignore Resources Flag Tests with ignoreSecrets=true flag should NOT reload when Secret changes with ignoreSecrets=true
  • Ignore Resources Flag Tests with ignoreSecrets=true flag should still reload when ConfigMap changes with ignoreSecrets=true

flags/namespace_ignore_test.go

  • Namespace Ignore Flag Tests with ignoreNamespaces flag should NOT reload in ignored namespace
  • Namespace Ignore Flag Tests with ignoreNamespaces flag should reload in watched (non-ignored) namespace

flags/namespace_selector_test.go

  • Namespace Selector Flag Tests with namespaceSelector flag should NOT reload workloads in non-matching namespaces
  • Namespace Selector Flag Tests with namespaceSelector flag should reload workloads in matching namespaces

flags/reload_on_create_test.go

  • Reload On Create Flag Tests with reloadOnCreate=false (default) should NOT reload when a new ConfigMap is created (default behavior)
  • Reload On Create Flag Tests with reloadOnCreate=true flag should reload when a new ConfigMap is created
  • Reload On Create Flag Tests with reloadOnCreate=true flag should reload when a new Secret is created

flags/reload_on_delete_test.go

  • Reload On Delete Flag Tests with reloadOnDelete=false (default) should NOT reload when a referenced ConfigMap is deleted (default behavior)
  • Reload On Delete Flag Tests with reloadOnDelete=true flag should reload when a referenced ConfigMap is deleted
  • Reload On Delete Flag Tests with reloadOnDelete=true flag should reload when a referenced Secret is deleted

flags/resource_selector_test.go

  • Resource Label Selector Flag Tests with resourceLabelSelector flag should NOT reload when unlabeled ConfigMap changes
  • Resource Label Selector Flag Tests with resourceLabelSelector flag should reload when labeled ConfigMap changes

flags/watch_globally_test.go

  • Watch Globally Flag Tests with watchGlobally=false flag should NOT reload workloads in other namespaces when watchGlobally=false
  • Watch Globally Flag Tests with watchGlobally=false flag should reload workloads in Reloader's namespace when watchGlobally=false
  • Watch Globally Flag Tests with watchGlobally=true flag (default) should reload workloads in any namespace when watchGlobally=true

@faizanahmad055 faizanahmad055 requested a review from Copilot May 11, 2026 09:32
Comment thread CLAUDE.md
Comment thread CLAUDE.md
Comment thread CLAUDE.md
Comment thread test/e2e/README.md
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR takes over and introduces a revamped end-to-end (e2e) testing setup centered around Ginkgo v2, adds supporting utilities (watch-based waiting, workload adapters, test environment/Helm helpers), and wires e2e execution into the CI workflow alongside several small refactors/cleanups in production code.

Changes:

  • Added a comprehensive Ginkgo v2 e2e test suite with shared utilities (watch helpers, workload adapter registry, Helm deploy/cleanup, cluster capability detection).
  • Added Makefile targets and scripts to set up/run/clean up e2e infrastructure (Kind + Argo Rollouts + CSI driver + Vault), and updated PR CI workflow to run e2e.
  • Refactored/cleaned up various internal packages (controller initialization guards, handler config extraction, import ordering, small naming tweaks) and introduced golangci-lint configuration.

Reviewed changes

Copilot reviewed 84 out of 90 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/loadtest/internal/cmd/run.go Import ordering / whitespace cleanup in loadtest command.
test/loadtest/internal/cmd/report.go Formatting/alignment tweaks in report structs.
test/e2e/utils/workload_statefulset.go New StatefulSet workload adapter for e2e suite.
test/e2e/utils/workload_openshift.go New OpenShift DeploymentConfig adapter for e2e suite.
test/e2e/utils/workload_job.go New Job adapter including recreation (UID) watch support.
test/e2e/utils/workload_deployment.go New Deployment adapter including pause/unpause watchers.
test/e2e/utils/workload_daemonset.go New DaemonSet adapter for e2e suite.
test/e2e/utils/workload_cronjob.go New CronJob adapter including triggered Job detection.
test/e2e/utils/workload_argo.go New Argo Rollout adapter including restartAt watch support.
test/e2e/utils/workload_adapter.go New cross-workload adapter interfaces + registry.
test/e2e/utils/watch.go New generic watch-based waiting primitives for e2e.
test/e2e/utils/utils.go New command execution + project dir + kubeconfig helpers.
test/e2e/utils/testenv.go New shared test environment setup/cleanup and deploy helpers.
test/e2e/utils/test_helpers.go New annotation merge helper.
test/e2e/utils/test_helpers_test.go Unit tests for annotation merge helper.
test/e2e/utils/rand.go New random name utilities for test resource uniqueness.
test/e2e/utils/rand_test.go Unit tests for random name utilities.
test/e2e/utils/openshift.go New OpenShift capability detection helper.
test/e2e/utils/helm.go New Helm deploy/undeploy helpers used by e2e suites.
test/e2e/utils/helm_test.go Unit tests for Helm helper parsing/utilities.
test/e2e/utils/conditions.go New reusable watch conditions (annotations, env vars, UID, SPCPS).
test/e2e/utils/argo.go New Argo Rollout creation helpers and install checks.
test/e2e/utils/annotations.go New constants/builders for Reloader annotations used by tests.
test/e2e/utils/accessors.go New typed accessors to support generic watch conditions.
test/e2e/README.md New e2e documentation (usage, labels, structure, examples).
test/e2e/flags/watch_globally_test.go New e2e tests for watchGlobally flag behavior.
test/e2e/flags/resource_selector_test.go New e2e tests for resourceLabelSelector behavior.
test/e2e/flags/reload_on_delete_test.go New e2e tests for reloadOnDelete behavior.
test/e2e/flags/reload_on_create_test.go New e2e tests for reloadOnCreate behavior.
test/e2e/flags/namespace_selector_test.go New e2e tests for namespaceSelector behavior.
test/e2e/flags/namespace_ignore_test.go New e2e tests for ignoreNamespaces behavior.
test/e2e/flags/ignored_workloads_test.go New e2e tests for ignoreCronJobs/ignoreJobs behavior.
test/e2e/flags/ignore_resources_test.go New e2e tests for ignoreSecrets/ignoreConfigMaps behavior.
test/e2e/flags/flags_suite_test.go New Ginkgo suite bootstrap for flags tests.
test/e2e/flags/auto_reload_all_test.go New e2e tests for autoReloadAll flag behavior.
test/e2e/csi/csi_suite_test.go New CSI suite bootstrap with cluster capability checks.
test/e2e/core/core_suite_test.go New core suite bootstrap + dynamic adapter registration.
test/e2e/argo/rollout_test.go New Argo-specific e2e tests for rollout-strategy behaviors.
test/e2e/argo/argo_suite_test.go New Argo suite bootstrap with install gating.
test/e2e/annotations/search_match_test.go New e2e tests for search/match annotations (incl. pending cases).
test/e2e/annotations/resource_ignore_test.go New e2e tests for ignore annotation on resources.
test/e2e/annotations/pause_period_test.go New e2e tests for pause-period behavior (incl. pending case).
test/e2e/annotations/annotations_suite_test.go New annotations suite bootstrap + dynamic adapter registration.
test/e2e/advanced/regex_test.go New e2e tests for regex pattern behaviors.
test/e2e/advanced/multi_container_test.go New e2e tests for multi-container and init-container CSI cases.
test/e2e/advanced/advanced_suite_test.go New advanced suite bootstrap.
scripts/e2e-cluster-cleanup.sh New cleanup script for Kind-installed e2e dependencies/resources.
pkg/kube/client.go Comment spacing cleanup in kube config selection.
pkg/common/config.go Import order/grouping cleanup.
pkg/common/common.go Refactor ShouldReload param naming + import grouping.
Makefile Added e2e targets; adjusted lint/test; added fmt and docker-build targets.
internal/pkg/util/util.go Import order/grouping cleanup.
internal/pkg/util/util_test.go Import order/grouping cleanup.
internal/pkg/util/interface.go Adjusted type assertions in ToObjectMeta/ParseBool.
internal/pkg/testutil/kube.go Import regrouping.
internal/pkg/leadership/leadership.go Minor loop/goroutine setup change in controller runner.
internal/pkg/leadership/leadership_test.go Import spacing tweak.
internal/pkg/handler/upgrade.go Import regrouping + minor variable/comment cleanup.
internal/pkg/handler/update.go Import order/grouping cleanup.
internal/pkg/handler/pause_deployment.go Import regrouping.
internal/pkg/handler/pause_deployment_test.go Import regrouping + error wrapping fix.
internal/pkg/handler/handlers_test.go New unit tests for handler config derivation/handling.
internal/pkg/handler/delete.go Small refactor in resource type checks + comment spacing.
internal/pkg/handler/create.go Small refactor in resource type checks.
internal/pkg/controller/controller.go Atomic init guards + safer handler type assertion; import regrouping.
internal/pkg/app/app.go Renamed local var to avoid package name shadowing.
.golangci.yml New golangci-lint configuration (linters + formatters).
.gitignore Ignore *.test artifacts.
.github/workflows/pull_request.yaml Bumped Kind version; added e2e dependency setup + e2e run steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/pkg/util/interface.go Outdated
Comment thread test/e2e/README.md Outdated
Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 84 out of 90 changed files in this pull request and generated 5 comments.

Comment on lines +28 to +32
{
name: "image with digest (not fully supported)",
image: "nginx@sha256:abc123",
expected: "nginx@sha256",
},
Comment on lines +45 to 51
// controllerInitialized flags guard against processing Add/Delete events before
// the worker goroutines have started. Written by runWorker (in a goroutine) and
// read by the informer event handlers, so they must be atomic.
var secretControllerInitialized atomic.Bool
var configmapControllerInitialized atomic.Bool
var selectedNamespacesCache []string

Comment thread internal/pkg/controller/controller.go Outdated
Comment on lines +53 to +54
func NewController(client kubernetes.Interface, resource string, namespace string, ignoredNamespaces []string, namespaceLabelSelector string, resourceLabelSelector string, collectors metrics.Collectors) (*Controller,
error) {
Comment on lines +42 to +59
// HasPodTemplateAnnotationChanged returns a condition that checks the pod template annotation
// is present AND its value differs from priorValue. If priorValue is empty, any non-empty value
// satisfies the condition (equivalent to HasPodTemplateAnnotation).
// Use this in WaitReloaded to correctly detect a reload after a prior reload has already set the annotation.
func HasPodTemplateAnnotationChanged[T any](accessor PodTemplateAccessor[T], key, priorValue string) Condition[T] {
return func(obj T) bool {
template := accessor(obj)
if template == nil || template.Annotations == nil {
return false
}
v, ok := template.Annotations[key]
if !ok {
return false
}
if priorValue == "" {
return true
}
return v != priorValue
Comment on lines +102 to +105
By("Verifying Deployment was NOT reloaded (different namespace with watchGlobally=false)")
time.Sleep(utils.NegativeTestWait)
reloaded, err := adapter.WaitReloaded(ctx, otherNS, deploymentName,
utils.AnnotationLastReloadedFrom, utils.ShortTimeout)
Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 85 out of 91 changed files in this pull request and generated 3 comments.

err := resourceHandler.(handler.ResourceHandler).Handle()
rh, ok := resourceHandler.(handler.ResourceHandler)
if !ok {
logrus.Errorf("Invalid resource handler type: %T", resourceHandler)
Comment thread Makefile Outdated
Comment on lines +165 to +173
$(CONTAINER_RUNTIME) build -t $(E2E_IMG) -f Dockerfile .
ifeq ($(notdir $(CONTAINER_RUNTIME)),podman)
$(CONTAINER_RUNTIME) save $(E2E_IMG) -o /tmp/reloader-e2e.tar
kind load image-archive /tmp/reloader-e2e.tar --name $(KIND_CLUSTER)
rm -f /tmp/reloader-e2e.tar
else
kind load docker-image $(E2E_IMG) --name $(KIND_CLUSTER)
endif
SKIP_BUILD=true RELOADER_IMAGE=$(E2E_IMG) "$(GOCMD)" tool ginkgo --keep-going -v --timeout=$(E2E_TIMEOUT) ./test/e2e/...
Comment thread Makefile Outdated
./scripts/e2e-cluster-setup.sh

.PHONY: e2e
e2e: ## Run e2e tests (builds image, loads to Kind, runs tests in parallel)
@github-actions
Copy link
Copy Markdown

✅ Load Test Results (quick)

✅ Load Test Results: ALL TESTS PASSED

🚀 Quick Test (S1, S4, S6) — Use /loadtest for full suite

3/3 passed (100%)

Scenario Description Actions Errors
S1 S1: 143 burst updates, each triggers 1 dep... 143/143 0
S4 S4: 143 no-op updates, all should be skipped 0 0
S6 S6: Restart test - 142 updates during restart 138 0

📦 Download detailed results


Artifacts: Download

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 85 out of 91 changed files in this pull request and generated 4 comments.

Comment on lines 27 to 34
func ParseBool(value interface{}) bool {
if reflect.Bool == reflect.TypeOf(value).Kind() {
return value.(bool)
b, _ := value.(bool)
return b
} else if reflect.String == reflect.TypeOf(value).Kind() {
result, _ := strconv.ParseBool(value.(string))
s, _ := value.(string)
result, _ := strconv.ParseBool(s)
return result
Comment on lines +16 to +19
ignoreNS string
cronJobAdapter *utils.CronJobAdapter
deploymentAdater *utils.DeploymentAdapter
)
Comment on lines +102 to +106
By("Verifying Deployment was NOT reloaded (different namespace with watchGlobally=false)")
time.Sleep(utils.NegativeTestWait)
reloaded, err := adapter.WaitReloaded(ctx, otherNS, deploymentName,
utils.AnnotationLastReloadedFrom, utils.ShortTimeout)
Expect(err).NotTo(HaveOccurred())
Comment thread test/e2e/README.md
Comment on lines +45 to +50
| `RELOADER_IMAGE` | `ghcr.io/stakater/reloader:test` | Image to test |
| `SKIP_BUILD` | `false` | Skip the container image build and Kind load steps; requires `RELOADER_IMAGE` to point to an already-loaded image |
| `KIND_CLUSTER` | `reloader-e2e` | Kind cluster name |
| `E2E_TIMEOUT` | `45m` | Test timeout |
| `GINKGO_PROCS` | `4` | Number of parallel Ginkgo worker processes |

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
@github-actions
Copy link
Copy Markdown

✅ Load Test Results (quick)

✅ Load Test Results: ALL TESTS PASSED

🚀 Quick Test (S1, S4, S6) — Use /loadtest for full suite

3/3 passed (100%)

Scenario Description Actions Errors
S1 S1: 143 burst updates, each triggers 1 dep... 143/143 0
S4 S4: 143 no-op updates, all should be skipped 0 0
S6 S6: Restart test - 142 updates during restart 146 0

📦 Download detailed results


Artifacts: Download

@github-actions
Copy link
Copy Markdown

✅ Load Test Results (quick)

✅ Load Test Results: ALL TESTS PASSED

🚀 Quick Test (S1, S4, S6) — Use /loadtest for full suite

3/3 passed (100%)

Scenario Description Actions Errors
S1 S1: 143 burst updates, each triggers 1 dep... 143/143 0
S4 S4: 143 no-op updates, all should be skipped 0 0
S6 S6: Restart test - 142 updates during restart 146 0

📦 Download detailed results


Artifacts: Download

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
@github-actions
Copy link
Copy Markdown

✅ Load Test Results (quick)

❌ Load Test Results: 1 TEST(S) FAILED

🚀 Quick Test (S1, S4, S6) — Use /loadtest for full suite

2/3 passed (66%)

Scenario Description Actions Errors
S1 S1: 143 burst updates, each triggers 1 dep... 143/143 0
S4 S4: 143 no-op updates, all should be skipped 0 0
S6 S6: Restart test - 0 updates during restart 0 0

📦 Download detailed results


Artifacts: Download

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 85 out of 91 changed files in this pull request and generated 4 comments.

Comment thread test/e2e/utils/watch.go
Comment on lines +25 to +33
// ErrWatchTimeout is returned when a watch times out waiting for condition.
var ErrWatchTimeout = errors.New("watch timeout waiting for condition")

// ErrWatchError is returned when the watch receives an error event from the API server.
var ErrWatchError = errors.New("watch received error event from API server")

// ErrUnsupportedOperation is returned when an operation is not supported for a workload type.
var ErrUnsupportedOperation = errors.New("operation not supported for this workload type")

Comment on lines +42 to +60
// HasPodTemplateAnnotationChanged returns a condition that checks the pod template annotation
// is present AND its value differs from priorValue. If priorValue is empty, any non-empty value
// satisfies the condition (equivalent to HasPodTemplateAnnotation).
// Use this in WaitReloaded to correctly detect a reload after a prior reload has already set the annotation.
func HasPodTemplateAnnotationChanged[T any](accessor PodTemplateAccessor[T], key, priorValue string) Condition[T] {
return func(obj T) bool {
template := accessor(obj)
if template == nil || template.Annotations == nil {
return false
}
v, ok := template.Annotations[key]
if !ok {
return false
}
if priorValue == "" {
return true
}
return v != priorValue
}
Comment thread Makefile
kind load docker-image $(E2E_IMG) --name $(KIND_CLUSTER)
endif
endif
RELOADER_IMAGE=$(E2E_IMG) "$(GOCMD)" tool ginkgo --keep-going -v --procs=$(GINKGO_PROCS) --timeout=$(E2E_TIMEOUT) ./test/e2e/...
Comment thread test/e2e/README.md
Comment on lines +43 to +50
| Variable | Default | Description |
|----------|----------------------------------|-------------|
| `RELOADER_IMAGE` | `ghcr.io/stakater/reloader:test` | Image to test |
| `SKIP_BUILD` | `false` | Skip the container image build and Kind load steps; requires `RELOADER_IMAGE` to point to an already-loaded image |
| `KIND_CLUSTER` | `reloader-e2e` | Kind cluster name |
| `E2E_TIMEOUT` | `45m` | Test timeout |
| `GINKGO_PROCS` | `1` | Number of parallel Ginkgo worker processes |

@github-actions
Copy link
Copy Markdown

✅ Load Test Results (quick)

✅ Load Test Results: ALL TESTS PASSED

🚀 Quick Test (S1, S4, S6) — Use /loadtest for full suite

3/3 passed (100%)

Scenario Description Actions Errors
S1 S1: 143 burst updates, each triggers 1 dep... 143/143 0
S4 S4: 143 no-op updates, all should be skipped 0 0
S6 S6: Restart test - 140 updates during restart 139 0

📦 Download detailed results


Artifacts: Download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants