test(estimation): move fixtures into testdata by incr3d1ble · Pull Request #17241 · argoproj/argo-workflows · GitHub
Skip to content

test(estimation): move fixtures into testdata - #17241

Merged
Joibel merged 2 commits into
argoproj:mainfrom
incr3d1ble:test/estimation-move-fixtures-to-testdata
Oct 27, 2026
Merged

Joibel merged 2 commits into
argoproj:mainfrom
incr3d1ble:test/estimation-move-fixtures-to-testdata

Conversation

@incr3d1ble

@incr3d1ble incr3d1ble commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
  • Ran make pre-commit -B — not runnable on this machine (Windows, no Linux toolchain); gofmt is clean on the changed files and the package tests pass locally, see Verification
  • Signed-off commits with Conventional Commit messages
  • PR title is a conventional commit message (it becomes the release notes entry)
  • Unit or e2e tests cover the change
  • For features: an associated issue and a feature description file (make feature-new) — N/A, test-only refactor
  • Opened as draft; will mark "Ready for review" once builds are green

Part of #13610

Motivation

workflow/controller/estimation/estimator_factory_test.go holds five workflow fixtures as inline string literals, which is the pattern #13610 asks to remove. This takes that file as one slice, following the shape of the merged slices (#17059, #17061, #17062, #17067).

Modifications

  • Moved the five fixtures into workflow/controller/estimation/testdata/estimator_factory/:

    fixture file
    wfFailed failed-baseline.yaml
    CWFT baseline cwft-baseline.yaml
    CWF baseline cwf-baseline.yaml
    WFTmpl baseline wftmpl-baseline.yaml
    archived baseline archived-wftmpl-baseline.yaml
  • All five fixtures are loaded with the @testdata/... file convention:

    • the workflow-typed one via the existing wfv1.MustUnmarshalWorkflow("@testdata/...");
    • the four that must stay *unstructured.Unstructured (the estimator type-asserts the informer index objects) via testutil.MustUnmarshalUnstructured, which now understands the same convention by delegating to wfv1.MustUnmarshal (per review feedback — the package-local file-reading helper is gone, so future tests can use @ paths directly).
  • Fixture content is byte-identical to the literals they replace. No test logic or assertions changed.

Verification

go test ./workflow/controller/estimation/ ./workflow/gccontroller/ -count=1

ok  	github.com/argoproj/argo-workflows/v4/workflow/controller/estimation
ok  	github.com/argoproj/argo-workflows/v4/workflow/gccontroller
  • gofmt clean on the changed files (committed content).
  • make pre-commit -B could not run locally (Windows); CI will cover lint/codegen.

Documentation

Not needed — test-only refactor with no user-facing change.

AI

Cerberus (OhMyOpenCode agent, GLM model) was used for the mechanical fixture extraction and test-file rewrite, directed by @incr3d1ble, who reviewed the result and ran the tests above.

Summary by CodeRabbit

  • Tests
    • Updated workflow estimation test scenarios to cover successful, failed, and archived workflows using reusable YAML examples. The scenarios are easier to review and maintain; no user-facing functionality or application behavior changes are included.

Move the five inline workflow YAML fixtures from estimator_factory_test.go
into testdata/estimator_factory/. Workflow-typed fixtures are loaded via the
wfv1.MustUnmarshalWorkflow "@testdata" convention; the four fixtures that must
stay *unstructured.Unstructured (the estimator type-asserts informer index
objects) load through a small file-reading helper reusing
testutil.MustUnmarshalUnstructured. Fixture content is byte-identical to the
literals they replace; no test logic or assertions changed.

Part of argoproj#13610

Signed-off-by: augustkevinsanjaya <120900788+incr3d1ble@users.noreply.github.com>
@incr3d1ble
incr3d1ble requested a review from a team as a code owner October 16, 2026 00:16
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 39e83ce and d079bff.

📒 Files selected for processing: 2
  • test/util/unstructured.go
  • workflow/controller/estimation/estimator_factory_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The estimator factory test now loads baseline workflows and templates from YAML fixture files instead of embedding their YAML. MustUnmarshalUnstructured now uses wfv1.MustUnmarshal.

Changes: Estimator factory test fixtures

Layer / File(s) Summary
Update unstructured unmarshalling
test/util/unstructured.go
MustUnmarshalUnstructured now delegates unmarshalling to wfv1.MustUnmarshal. Its comment describes file, JSON, and YAML inputs.
Load estimator baselines from fixtures
workflow/controller/estimation/estimator_factory_test.go, workflow/controller/estimation/testdata/estimator_factory/*
The test loads the failed workflow, workflow templates, cron workflow, and archived workflow from YAML fixtures. The fixtures define manifest names and phase labels.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Suggested reviewers: isubasinghe

Merge Risk: ⚪ Minimal · up to d079b

The fixture migration introduces no identified merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: moving estimation test fixtures into testdata.
Description check Passed The description covers the required sections, explains the motivation and modifications, records verification results and limitations, addresses documentation, and declares AI use. The unchecked draft…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description covers the required sections, explains the motivation and modifications, records verification results and limitations, addresses documentation, and declares AI use. The unchecked draft status is explained and the issue reference is provided.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 46.34%. Comparing base (84efaa5) to head (d079bff).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
test/util/unstructured.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17241      +/-   ##
==========================================
+ Coverage   46.19%   46.34%   +0.15%     
==========================================
  Files         588      591       +3     
  Lines       40185    40336     +151     
==========================================
+ Hits        18562    18693     +131     
- Misses      21621    21641      +20     
  Partials        2        2              
Flag Coverage Δ
unit-tests 46.28% <0.00%> (+0.16%) ⬆️
unit-tests-windows 32.43% <0.00%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we just make MustUnmarshalUnstrucutred understand the @ convention instead of this - so that future tests can also use it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — testutil.MustUnmarshalUnstructured now understands the @ convention by delegating to wfv1.MustUnmarshal (which already implements @file/JSON/strict-YAML), and the package-local mustUnmarshalUnstructuredFile helper is removed. The estimation test loads its four unstructured fixtures via @testdata/... directly: d079bff. Behavior for the other caller (workflow/gccontroller/heap_test.go, inline YAML) is unchanged — still strict-YAML unmarshal. Package tests for both callers pass locally.

Make testutil.MustUnmarshalUnstructured delegate to wfv1.MustUnmarshal so it understands the "@file" convention (and JSON) instead of a package-local helper, letting future tests load unstructured fixtures from testdata directly. The estimation test now loads its four unstructured fixtures via "@testdata/..." paths; no test logic changed.

Part of argoproj#13610

Fullscanned with [Cerberus](https://github.com/code-yeongyu/oh-my-open-pentest)
Co-authored-by: Cerberus <clio-agent@cerberuslabs.ai>

Signed-off-by: Kevin <120900788+incr3d1ble@users.noreply.github.com>
@Joibel
Joibel enabled auto-merge (squash) October 27, 2026 14:53

@Joibel Joibel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a lot, looks good

@Joibel
Joibel merged commit d3b8e91 into argoproj:main Oct 27, 2026
52 checks passed
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.

2 participants