* Feat: expose HTTP timeout on built-in workflow steps
Allow request, webhook, and notification steps to set an optional
timeout (Go duration string) that is forwarded to http.#HTTPDo as
request.timeout, so slow HTTP calls are no longer stuck at the 3s default.
Signed-off-by: shaurya2k06 <shaurya2k06@gmail.com>
* Feat: Made requested changes
Signed-off-by: shaurya2k06 <shaurya2k06@gmail.com>
* Fix: align timeout duration regex with Go ParseDuration
Accept "0" and leading-dot fractions like ".5s", matching
time.ParseDuration more closely while still rejecting unit-less
values such as "30".
Signed-off-by: shaurya2k06 <shaurya2k06@gmail.com>
---------
Signed-off-by: shaurya2k06 <shaurya2k06@gmail.com>
- Bump github.com/kubevela/pkg to v1.11.0 and github.com/kubevela/workflow to v0.7.0
- Remove local replace directives for both modules
- Wire EnableCUEVersionCompatibility as a pointer alias into the engine to eliminate data race
- Add --enable-cue-version-compatibility and --cue-compatibility-cache-size flags via CUEConfig
- Fix all call sites (webhooks, CLI def.go) to dereference the pointer alias correctly
- Add individual revive-compliant doc comments on re-exported types
- Add examples/legacy-upgrade-demo/ demonstrating runtime legacy list syntax rewriting
Signed-off-by: Brian Kane <briankane1@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(workflow): add deploy-components step for per-component multi-cluster targeting
Adds a pure-CUE workflow-step definition that lets each component in an
Application resolve its own target cluster(s) via topology policies,
filling the gap between apply-component (single component, static
cluster) and deploy (all components, cross-product against policies).
Signed-off-by: vishal210893 <vishal210893@gmail.com>
* chore(workflow): add rendered deploy-components WorkflowStepDefinition manifest
Generated from vela-templates/definitions/internal/workflowstep/deploy-components.cue
via make def-install, for installation as part of the vela-core Helm chart.
Signed-off-by: vishal210893 <vishal210893@gmail.com>
* test(e2e): add multicluster e2e for deploy-components step
Covers per-component topology-policy targeting (each component lands only
on its resolved cluster, no cross-product) and fast-fail validation when a
referenced component name is not present in the application.
Signed-off-by: vishal210893 <vishal210893@gmail.com>
* docs(workflow): add example doc for deploy-components step
Required by the definition-doc CI check for any new WorkflowStepDefinition.
Signed-off-by: vishal210893 <vishal210893@gmail.com>
* fix(workflow): normalize deploy-components import block to grouped form
The rendered manifest was generated with flat "import X" lines; the
project's CUE formatter (as used by CI's make reviewable) renders
multi-import blocks grouped as import (...). Fixes the check-diff CI job.
Signed-off-by: vishal210893 <vishal210893@gmail.com>
* fix(workflow): gate deploy-components applies on validation to prevent partial rollout
Previously, _missingComponents was derived from deploy's own realized keys,
which meant an invalid component name could only be detected after applies
for valid components had already started -- a partial rollout on failure.
Compute _missingComponents directly from the loaded component set instead
(via iteration, matching the pattern deploy itself already uses reliably --
an indexed lookup against the same field was empirically found to evaluate
before the load task resolves, causing false positives), and wrap deploy in
an if-guard so no component is applied unless every referenced name is
valid. Verified against a live multicluster setup: the negative case now
applies zero resources before failing, and the positive case is unaffected.
Signed-off-by: vishal210893 <vishal210893@gmail.com>
* style(workflow): tighten deploy-components comments
Comments narrated the debugging history behind each constraint; state
them as plain engineering facts instead.
Signed-off-by: vishal210893 <vishal210893@gmail.com>
* fix(workflow): correct mistyped #do string in multicluster.#GetPlacementsFromTopologyPolicies
The exported CUE symbol's #do value ("get-placements-from-tmulticlusterology-policies")
never matched the registered provider handler key ("get-placements-from-topology-policies"),
making it unusable by any CUE template. Fix the string and rename the symbol
to match. Unused elsewhere in the tree, so no other callers are affected.
deploy-components keeps its own local copy (for backport safety) but now
documents that it mirrors the corrected symbol.
Signed-off-by: vishal210893 <vishal210893@gmail.com>
* refactor(workflow): use the shared topology-placement symbol in deploy-components
Now that multicluster.#GetPlacementsFromTopologyPolicies is fixed, drop the
local #GetPlacements duplicate and reference the shared symbol directly.
deploy-components is new in this release, so there's no backport scenario
where it could ship without the fix landing alongside it.
Verified against a live multicluster controller build: positive case
resolves placements and applies correctly, negative case still gates
deploy on validation with zero partial rollout.
Signed-off-by: vishal210893 <vishal210893@gmail.com>
---------
Signed-off-by: vishal210893 <vishal210893@gmail.com>
* Refactor(helm): extract type declarations into types.go
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Refactor(helm): extract Provider, constructors, and dry-run
ctx into provider.go
Move the Provider singleton, NewProvider/NewProviderWithConfig
constructors, DefaultCacheTTLConfig, the dry-run context helpers
(WithDryRun/isDryRun), and the small log/cache key utilities out of
helm.go into a dedicated provider.go.
No behavior change. All 240 unit specs remain green.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Refactor(helm): extract chart fetching into chart_fetch.go
Move detectChartSourceType, isMutableVersion, fetchChart
(cache wrapper), fetchChartWithoutCache, determineCacheTTL, and the
three per-source fetchers (fetchOCIChart, fetchURLChart,
fetchRepoChart) out of helm.go.
No behavior change. All 240 unit specs remain green.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Refactor(helm): extract values resolution into values.go
Move mergeValues, loadValuesFromSource,
resolveValuesFromNamespace, loadConfigMapValues, loadSecretValues,
plus the valueSourceMissingError sentinel and
errCrossNamespaceValuesFrom guard out of helm.go.
No behavior change. All 240 unit specs remain green.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Refactor(helm): extract post-renderer and ownership helpers
into postrender.go
Move getActionConfig, velaLabelPostRenderer (struct + Run),
velaOwnerLabels, and isOwnedByVela out of helm.go.
No behavior change. All 240 unit specs remain green.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Refactor(helm): extract manifest parsing into manifest.go
Move parseManifestResources, isClusterScopedGVK,
isClusterScopedKindStaticFallback, isTestResource, cleanResource,
and orderResources out of helm.go.
No behavior change. All 240 unit specs remain green.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Refactor(helm): extract release secret lifecycle into
release_secrets.go
Move validateReleaseHealth, cleanOrphanedReleaseSecrets,
listReleaseSecretNames, labelReleaseSecrets,
deleteReleaseSecretsDirect, and InvalidateRelease out of helm.go.
No behavior change. All 240 unit specs remain green.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Refactor(helm): extract dry-run render into dryrun.go
Move dryRunRender (used by webhook validation) and
getKubeVersion (cluster Kubernetes version capabilities lookup) out
of helm.go.
No behavior change. All 240 unit specs remain green.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Refactor(helm): extract release dispatcher into release.go
Move installOrUpgradeChart (dispatcher between install/upgrade
with fingerprint dedup, adoption detection, and publishVersion pin
short-circuit) and computeReleaseFingerprint out of helm.go.
No behavior change. All 240 unit specs remain green.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Refactor(helm): split install/upgrade into install.go and
upgrade.go with option appliers
Move freshInstall, newInstallAction, and
isRetryableInstallError into install.go. Extract the inline upgrade
block from installOrUpgradeChart into a new performUpgrade function
in upgrade.go.
Introduce applyCommonInstallOptions and
applyCommonUpgradeOptions free functions that own option-to-action
wiring per Helm action type. The asymmetry between the two
(MaxHistory/CleanupOnFail/Recreate live only in the upgrade applier)
is now visible in code and reflects the Helm SDK shape.
No behavior change. All 240 unit specs remain green.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Chore(helm): remove Uninstall provider (unused)
The helmchart ComponentDefinition only calls helm.#Render.
Deletion is handled by KubeVela GC and ResourceTracker, never by
helm uninstall, so the Uninstall CUE template and the workflow
provider registration were exercised by tests only.
Touched: UninstallParams/UninstallReturns in types.go, the
Uninstall Go function and its registration in helm.go, the
#Uninstall block in helm.cue, the uninstall registration in
pkg/workflow/providers/helm/helm.go, and the corresponding
helm_test.go cases.
No behavior change for any in-tree caller. All 237 remaining
unit specs remain green.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Fix(helm): wire includeCRDs and install-path force; drop waitTimeout (#7151)
includeCRDs was a complete no-op: the field was declared on RenderOptionsParams but never read. Wire it through SkipCRDs on both action.Install and action.Upgrade (inverted, since the user-facing field expresses inclusion).
force was wired on upgrade only. action.Install has a Force field in Helm SDK v3.14.4, so wire it there too.
waitTimeout had no backing Helm SDK field (only Timeout exists, covering both connection and wait). Remove the field from RenderOptionsParams and the CUE schema. timeout now documents its dual role.
maxHistory, cleanupOnFail, and recreatePods stay upgrade-only per the Helm SDK shape; CUE comments now state this explicitly.
Tests: 18 new specs covering applyCommonInstallOptions and applyCommonUpgradeOptions (each option, nil opts, unparseable timeout, asymmetry of upgrade-only fields). Suite: 258 of 258 passing.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Refactor(helm): split helm_test.go alongside production files
helm_test.go was a single 2500-line test file. Mirror the production file layout: types_test.go, provider_test.go, chart_fetch_test.go, values_test.go, postrender_test.go, manifest_test.go, release_test.go, release_secrets_test.go, dryrun_test.go, install_test.go (extended with isRetryableInstallError/newInstallAction/freshInstall), upgrade_test.go. helm_test.go now owns only Render-entry tests (matching helm.go after the production split).
No test logic change. Suite remains 258 of 258 passing.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Docs(helm): add one-line responsibility comment to each provider file
Every production .go file in the helm provider now opens with a single descriptive line immediately after the package declaration, so a reader can scan the directory and know what each file owns without opening it.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* chore(helm): fix the helmchart CD
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Test(helm): drop uninstall expectations from workflow provider tests
CI revealed three failing assertions in pkg/workflow/providers/helm: GetTemplate was expected to contain 'uninstall', and GetProviders was expected to expose an uninstall key with a non-nil function. The Uninstall provider was removed earlier in this branch since the native helmchart ComponentDefinition never invoked it, but the workflow-provider tests still referenced it. Update them to assert the render-only surface.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Fix(helm): address cubic AI review on PR #7154
P0: release.go installOrUpgradeChart only treats driver.ErrReleaseNotFound as a missing release; other Get errors are surfaced rather than silently falling through to freshInstall.
P1: release.go guards existingRelease.Info nil before reading Status. postrender.go isOwnedByVela now matches the full velaCtx triple (AppName + AppNamespace + Name) rather than any non-empty ownership label, so two Applications targeting the same release name in the same namespace do not mis-detect each other as already owned.
P2: values.go deep-clones inline values before CoalesceTables so nested maps cannot be mutated through to the caller. dryrun.go uses the full server GitVersion when present so charts with patch-level kubeVersion constraints validate correctly. install.go isRetryableInstallError now catches 'cannot reuse a name that is still in use' and the dash-hyphen variant. upgrade.go applyCommonUpgradeOptions documents that helm v3 only consults SkipCRDs on the install-mode upgrade path. postrender.go Run no longer short-circuits when only the context is nil, so direct callers still get namespace defaulting.
Tests: remove three non-hermetic / no-cluster tests that did not actually assert their named behaviour. values_test now uses distinct application and release namespaces in the cross-namespace guard scenario, and adds a second positive case for the release-namespace branch. chart_fetch_test fetchOCIChart-with-auth block now captures and restores singleton.KubeClient via BeforeEach/AfterEach to match the sibling fetchURLChart and fetchRepoChart blocks. Suite stays green at 255 specs.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Fix(helm): preserve numeric types in inline-values deep clone
Cubic flagged the JSON round-trip in deepCloneValues for coercing int to float64. Switch to runtime.DeepCopyJSON which walks the same nested map/slice/scalar shape but preserves Go numeric types. Templates that depend on integer type assertions (e.g. {{ .Values.replicaCount | int }}) now see the original type instead of a coerced float.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Fix(helm): deep-clone inline values without runtime.DeepCopyJSON
Cubic flagged that runtime.DeepCopyJSON panics on plain int values because the helper only accepts the narrow set of types json.Unmarshal returns. CUE evaluation routinely produces Go int / int32 / int64 values, so the previous switch from json round-tripping to runtime.DeepCopyJSON traded one bug (int->float64 coercion) for another (panic on int).
Replace with a hand-rolled recursive walk that recreates maps and slices and copies scalars by interface assignment. Scalars are immutable in Go, so the interface copy is sufficient. The implementation accepts every type CUE evaluation can produce.
Add five focused unit tests: nil input, int preservation, int64/float64 preservation, nested-map isolation, and slice isolation. Suite at 260 specs.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* ci: retrigger checks
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Test(helm): exercise installOrUpgradeChart with helm fake KubeClient
Codecov patch coverage was failing because the file split moved installOrUpgradeChart into a new file (release.go) with no direct coverage. The previous unit tests were no-cluster smokes that did not assert anything meaningful and were rightly deleted earlier in this branch on cubic feedback.
Add a small seam (actionConfigFactory field on Provider, defaulting to the real cluster getter) so tests can swap in helm SDK kubefake.PrintingKubeClient plus an in-memory release storage driver. Six new specs exercise the dispatcher end-to-end: fresh install, fingerprint dedup short-circuit, chart-version upgrade, values-change upgrade, adoption of vanilla helm releases, and publishVersion pin short-circuit.
Package coverage climbs from ~71% to 82.6%. installOrUpgradeChart goes from 0% to 85.2%. performUpgrade goes from 0% to 90.9%. The remaining gaps (freshInstall retry path, release_secrets cluster helpers) require a real Kubernetes API and are exercised in the e2e suite.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Test(helm): plug the second cluster-leak seam in dispatcher tests
Cubic flagged that the new dispatcher tests still let real Kubernetes calls escape: validateReleaseHealth (started as a goroutine after fingerprint-dedup short-circuit) called p.getActionConfig directly, and labelReleaseSecrets / listReleaseSecretNames / deleteReleaseSecretsDirect built a clientset from p.helmClient.RESTClientGetter().
Add a kubeClientFactory field on Provider next to actionConfigFactory and route all four helpers through it. installProviderWithFake injects a clientsetfake clientset alongside the fake action.Configuration. The release_secrets tests are reworked to use the helper as well, replacing the previous 'should not panic without a real cluster' smokes with assertions against the fake clientset: list filters to vela-owned secrets, label patches missing labels but never overwrites existing ones, delete cleans only matching helm-owned secrets.
Verified the suite emits zero 'Kubernetes cluster unreachable' log lines now. 266 specs green. Also strengthened the adoption test to assert all three app.oam.dev ownership labels.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* ci: retrigger checks
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* ci: retrigger checks
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Fix(helm): restore corrupt-secret recovery via fall-through-on-any-Get-error
The earlier cubic-driven P0 fix narrowed the dispatcher to fall through to freshInstall only when getAction.Run returned driver.ErrReleaseNotFound. That broke the documented self-healing contract validated by test/e2e-test/helmchart_test.go ('Helmchart Self-Healing / should recover from corrupted Helm release secret'): a corrupted .data.release surfaces from the helm storage driver as a decode error (base64 / gzip / json), not as driver.ErrReleaseNotFound, so the strict check trapped those errors and skipped the orphan-state cleanup path that freshInstall + isRetryableInstallError implement.
Restore the original fall-through-on-any-error behaviour with two safety improvements: (1) non-NotFound errors are now logged at warning level so operators can spot RBAC / transient API failures that the recovery path then addresses (or fails to address); (2) the fingerprint slice in the stale-cache-clear log is bounds-checked so a short cached value cannot panic.
Add a unit regression that wraps the in-memory storage driver in a corruptingDriver returning a synthetic decode error for the named release. Asserts the dispatcher swallows the error, runs fresh install, and repopulates the cache with the new fingerprint. Mirrors the e2e contract at the unit-test layer so a future refactor cannot regress this without breaking both gates.
Suite: 267 of 267 passing.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Test(helm): seed corruption-recovery test at the canonical helm storage key
Cubic flagged that the new corrupt-secret regression seeded the in-memory storage driver at 'rel.v1' while helm SDK derives canonical keys of the form 'sh.helm.release.v1.<name>.v<version>'. The mismatch meant the seeded release never collided with helms install-path probe and the test passed without actually exercising the recovery branch.
Switch the seed key to the canonical form via the same makeKey shape helm SDK uses internally. The corruptingDriver layered on top still returns a synthetic decode error for Get/Query against the named release, so the dispatcher is forced through the swallow-and-fall-through path. Tightened the comment to be explicit about test scope: this unit pins the dispatcher-layer contract, the e2e test pins the end-to-end cleanup. Also relaxed the pre-seeded cache fingerprint to a realistic-length value so the truncation-safe log path exercises cleanly.
Suite: 267 of 267 passing.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* ci: retrigger checks
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* ci: retrigger checks
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Test(helm): drop canonical-key seed from corruption-recovery test
The canonical-key seed made the in-memory storage collide with the key helm SDK derives for the release, which triggered the orphan-state cleanup retry path in freshInstall. Cleanup uses the kubeClientFactory clientset (a fake clientset with no helm release secrets) so it deletes nothing; the storage-driver entry stays put; the retry install then fails with release: already exists. CI confirmed against the previous commit.
Seed only the corruptingDriver this time, no pre-existing release in storage. The dispatcher swallows the synthetic decode error from Get/Query and falls through to a clean fresh install, which is the contract this unit test is meant to pin. The full storage + clientset cleanup loop remains exercised by the e2e Helmchart Self-Healing scenario.
Updated the test comment to be explicit about scope: storage and clientset are intentionally not bridged in the fake setup; that bridging belongs in the e2e test, not here.
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* ci: retrigger checks
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
---------
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Fix: Align legacy config provider keys with workflow repo to resolve CUE conflict and kube key collision
Rename legacy config #do keys and Go provider map keys from short form
(create, read, list, delete) to hyphenated form (create-config,
read-config, list-config, delete-config) to match workflow PR #225.
This resolves three issues:
- CUE unification failure when kubevela and workflow legacy config
templates are concatenated into the same op package
- Go provider key collision where kube's read/list/delete silently
overwrote config's identically-named functions
- Silent misdispatch of op.#ReadConfig/ListConfig/DeleteConfig to
kube handlers instead of config handlers
Signed-off-by: Jerrin Francis <jerrinfrancis7@gmail.com>
* Adding testcase to test future key drifts
Signed-off-by: Jerrin Francis <jerrinfrancis7@gmail.com>
---------
Signed-off-by: Jerrin Francis <jerrinfrancis7@gmail.com>
* feat(monitor): Add unit tests for application metrics watcher
This commit introduces a new test file with comprehensive unit tests for the application metrics watcher functionality in pkg/monitor/watcher.
Key additions include:
- Test cases for the application metrics watcher's inc() method covering add, delete, and update operations
- Test cases for report() method that verifies dirty flags are cleared
- Test cases for helper functions getPhase() and getApp()
These additions improve the overall test coverage and ensure the correctness of the application metrics monitoring functionality.
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
* feat(velaql): Add comprehensive unit tests for ParseVelaQLFromPath
This commit introduces new unit tests for the ParseVelaQLFromPath function in pkg/velaql, along with test data files to improve test coverage and ensure correctness.
Key additions include:
- `pkg/velaql/parse_test.go`: Adds TestParseVelaQLFromPath function with comprehensive test cases covering:
* Valid CUE files with and without export fields
* Nonexistent and empty file paths
* Invalid CUE content
* Files with invalid export types
- Test data files in pkg/velaql/testdata/:
* simple-valid.cue: Valid CUE file with export field
* simple-no-export.cue: Valid CUE file without export field
* empty.cue: Empty CUE file
* invalid-cue-content.cue: CUE file with invalid syntax
* invalid-export.cue: CUE file with invalid export type
These additions improve the overall test coverage and ensure the robustness of the VELAQL parsing functionality.
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
* feat(webhook): Add unit tests for ValidateDefinitionRevision function
This commit introduces new unit tests for the ValidateDefinitionRevision function in pkg/webhook/utils to improve test coverage and ensure correctness of definition revision validation.
Key additions include:
- `pkg/webhook/utils/utils_test.go`: Adds TestValidateDefinitionRevision function with comprehensive test cases covering:
* Success scenarios with matching definition revisions
* Success scenarios when definition revision does not exist
* Failure scenarios with revision hash mismatches
* Failure scenarios with spec mismatches
* Failure scenarios with invalid definition revision names
These additions improve the overall test coverage and ensure the robustness of the webhook utility functions for validating definition revisions.
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
* feat(workflow): Add unit tests for OAM apply and query utilities
This commit introduces new unit tests for workflow provider functions in pkg/workflow/providers to improve test coverage and ensure correctness.
Key additions include:
- `pkg/workflow/providers/oam/apply_test.go`: Adds TestRenderComponent function with comprehensive test cases for component rendering
- `pkg/workflow/providers/query/utils_test.go`: Adds:
* TestBuildResourceArray function with comprehensive test cases covering simple, nested, and complex resource tree scenarios
* TestBuildResourceItem function with test cases for resources with and without annotations
These additions improve the overall test coverage and ensure the robustness of the workflow provider functions for OAM applications.
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
* fix(velaql): Improve error handling in ParseVelaQLFromPath test
This commit addresses an issue in the TestParseVelaQLFromPath function where file read errors were being silently ignored. The changes include:
- Removing the unused expectedView field from test cases
- Replacing conditional error checking with require.NoError to ensure file read operations are properly validated
- Ensuring that test failures are properly reported when file reading fails
This fix improves the reliability of the test suite by making sure that any file I/O errors are properly caught and reported rather than silently ignored.
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
* feat: Apply cross-cutting test improvements
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
* feat: Enhance test coverage with file-specific suggestions
This commit applies file-specific suggestions to enhance the test suite's
coverage and robustness.
Key changes include:
- **`pkg/monitor/watcher/application_test.go`**:
- Added a test case for a multi-step workflow with mixed phases to
validate `stepPhaseCounter` aggregation.
- Added a test for idempotence by calling `inc` twice.
- Added test cases for an empty workflow and an unknown application phase.
- Strengthened the `report` test to assert that counters are not cleared.
- **`pkg/velaql/parse_test.go`**:
- Added a test case for `ParseVelaQLFromPath` to handle files with
leading/trailing whitespace.
- Added a test case to ensure consistent error messages for relative paths.
- **`pkg/webhook/utils/utils_test.go`**:
- Added a test case to `TestValidateCueTemplate` for a malformed CUE
template.
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
---------
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
Webhook Upgrade Validation / webhook-upgrade-check (push) Failing after 24s
* Fix: Update ingress messages to handle host retrieval more robustly across multiple templates
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Fix: Enhance output handling in k8s-objects template to check for empty objects
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* Fix: Ensure policy selection from envBindingPolicies only occurs if the list is not empty
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
---------
Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
* feat(multicluster): Enhance unit test coverage for multicluster utilities
This commit introduces a comprehensive suite of unit tests for the multicluster management functions in pkg/multicluster.
Key changes include:
- `cluster_management_test.go`: Improves the structure of TestDetachCluster and TestRenameCluster by organizing test cases into a collection, which enhances clarity and
simplifies adding new scenarios.
- `utils_test.go` and `virtual_cluster_test.go`: Adds new test cases to validate additional utility and virtual cluster helper functions, increasing overall test
coverage.
These additions improve the overall test coverage and ensure the correctness and reliability of multicluster operations.
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
* feat(multicluster): Add unit tests for multicluster workflow provider
This commit introduces new unit tests for the multicluster workflow provider located in pkg/workflow/providers/multicluster.
Key additions include:
- Comprehensive tests for the Deploy workflow step, covering parameter validation, error handling, and successful deployment scenarios.
- New tests for GetPlacementsFromTopologyPolicies to ensure correct placement resolution from topology policies, including error cases and default behaviors.
These additions improve the test coverage and ensure the robustness of the multicluster workflow provider.
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
* fix(multicluster): Correct duplicate import in utils_test.go
This commit resolves a linting error (ST1019) in pkg/multicluster/utils_test.go caused by the k8s.io/api/core/v1 package being imported twice with different aliases (v1
and corev1).
The redundant import alias v1 has been removed, and the corresponding type reference for []v1.Secret has been updated to []corev1.Secret to maintain consistency.
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
* test(multicluster): fix cross-test side effects
The TestListExistingClusterSecrets function mutates the global
variable ClusterGatewaySecretNamespace without restoring its original
value. This can lead to unpredictable behavior in other tests that
rely on this variable.
This commit fixes the issue by saving the value of
ClusterGatewaySecretNamespace before the test runs and restoring it
afterward using a defer statement.
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
* test(multicluster): remove redundant test case in TestContext
The `TestContextWithClusterName` sub-test in `TestContext` is redundant, as its functionality is already covered by the more comprehensive `TestClusterNameInContext` sub-test.
This commit removes the unnecessary test to improve the clarity and maintainability of the test suite without sacrificing coverage.
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
---------
Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>
* fix: check component status after initial deployment
Signed-off-by: Brian Kane <briankane1@gmail.com>
* Fix: applications should correctly reflect component health throughout the apps lifecycle
Signed-off-by: Brian Kane <briankane1@gmail.com>
* Fix: check component status after initial deployment
Signed-off-by: Brian Kane <briankane1@gmail.com>
---------
Signed-off-by: Brian Kane <briankane1@gmail.com>
Co-authored-by: Mikhail Elenskii <elenskii-mikhail@outlook.com>