Skip to content

Add short test mode to skip long-running tests - #1605

Merged
Andriy Knysh (aknysh) merged 1 commit into
mainfrom
osterman/skip-long-tests
Oct 7, 2025
Merged

Andriy Knysh (aknysh) merged 1 commit into
mainfrom
osterman/skip-long-tests

Conversation

@osterman

Copy link
Copy Markdown
Member

what

  • Add support for Go's -short flag to skip long-running tests (>2 seconds)
  • Enable faster development feedback loop while preserving comprehensive CI testing
  • Add SkipIfShort() helper function for Go tests
  • Add short field to YAML test case schema (defaults to true)
  • Mark 13 Go tests and 9 YAML tests as long-running
  • Add make test-short and make test-short-cover Makefile targets
  • Fix AWS profile precondition failures in 2 auth tests

why

  • Developers need faster test feedback during development
  • Full test suite takes 3+ minutes, making rapid iteration slow
  • Many tests require network I/O, Git operations, or binary compilation (>2s each)
  • CI should run all tests, but local development benefits from quick tests
  • Follows Go's standard -short flag convention for test skipping

Performance Impact

Before: Full test suite only (~3+ minutes)

After:

  • Quick mode (make test-short): ~2m30s (skips 30+ seconds of slow tests)
  • Full mode (make testacc): ~3m+ (runs everything including slow tests)

Changes by Category

Go Tests Marked Long (13 tests)

  • Git operations (3 tests, ~60s saved):
    • TestDescribeAffectedWithTargetRefClone (36s - Git cloning)
    • TestExecuteAtlantisGenerateRepoConfigAffectedOnly (21s - Git ops)
    • TestExecuteTerraformAffectedWithDependents (26s - Git + Terraform)
  • Network I/O (3 tests, ~10s saved):
    • TestVendorComponentPullCommand (6s)
    • TestVendorPullFullWorkflow (network + OCI)
    • TestVendorPullBasicExecution (4s)
  • Binary compilation (7 tests in testhelpers, ~100s saved):
    • All atmos binary build tests (15-20s each)
  • AWS SDK (2 tests, now with proper preconditions):
    • TestAssumeRoleIdentity_newSTSClient_RegionFallbackAndPersist
    • TestPermissionSetIdentity_newSSOClient_Success

YAML Tests Marked Long (9 tests)

All vendor pull tests requiring network I/O:

  • tests/test-cases/vendor-test.yaml (2 tests)
  • tests/test-cases/demo-vendoring.yaml (2 tests)
  • tests/test-cases/demo-globs.yaml (1 test)
  • tests/test-cases/vendoring-ssh-dryrun.yaml (3 tests)

Infrastructure

  • New helper: tests.SkipIfShort(t) in tests/preconditions.go
  • Schema update: Added short field to tests/test-cases/schema.json
  • CLI framework: Modified tests/cli_test.go to check short mode before running tests
  • Makefile targets: test-short and test-short-cover
  • Documentation: Updated CLAUDE.md and tests/README.md

Testing

# Quick tests pass in ~2m30s
make test-short

# All tests still pass (full suite)
make testacc

# Verify long tests are skipped
go test -short -v ./internal/exec | grep SKIP

# Verify long tests run without -short
go test -v ./internal/exec | grep "TestExecuteTerraformAffectedWithDependents"

Usage

# Development: quick feedback
make test-short
go test -short ./...

# CI/comprehensive testing
make testacc
go test ./...

# With coverage
make test-short-cover
go test -short -cover ./...

references

🤖 Generated with Claude Code

Add support for Go's `-short` flag to skip tests taking >2 seconds. This enables faster feedback during development while preserving comprehensive testing in CI.

**Changes:**
- Add `SkipIfShort()` helper function in tests/preconditions.go
- Add `short` field to YAML test case schema (defaults to true)
- Mark 13 Go tests with `SkipIfShort()` (Git ops, vendor pulls, binary builds, Terraform, AWS SDK)
- Mark 9 YAML tests with `short: false` (vendor pulls requiring network I/O)
- Add `make test-short` and `make test-short-cover` targets
- Update CLAUDE.md and tests/README.md with usage examples
- Add AWS profile preconditions to 2 tests that require credentials

**Performance:**
- Quick tests: ~2m30s (skips 30+ seconds of long tests)
- Full tests: ~3m+ (runs all tests including long ones)

**Usage:**
```bash
make test-short              # Quick tests only
make testacc                 # All tests including long ones
go test -short ./...         # Direct Go command
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the size/m Medium size PR label Oct 7, 2025
@mergify

mergify Bot commented Oct 7, 2025

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify Bot added the needs-cloudposse Needs Cloud Posse assistance label Oct 7, 2025
@codecov

codecov Bot commented Oct 7, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.52%. Comparing base (41200b0) to head (d18c14e).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
tests/preconditions.go 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1605      +/-   ##
==========================================
+ Coverage   63.49%   63.52%   +0.02%     
==========================================
  Files         323      323              
  Lines       37061    37067       +6     
==========================================
+ Hits        23533    23547      +14     
+ Misses      11580    11568      -12     
- Partials     1948     1952       +4     
Flag Coverage Δ
unittests 63.52% <50.00%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
tests/preconditions.go 80.32% <50.00%> (-0.75%) ⬇️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@osterman Erik Osterman (Cloud Posse) (osterman) added the no-release Do not create a new release (wait for additional code changes) label Oct 7, 2025
@aknysh
Andriy Knysh (aknysh) merged commit aefb2b3 into main Oct 7, 2025
66 of 68 checks passed
@aknysh
Andriy Knysh (aknysh) deleted the osterman/skip-long-tests branch October 7, 2025 14:33
@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label Oct 7, 2025
Erik Osterman (Cloud Posse) (osterman) added a commit that referenced this pull request Oct 7, 2025
Add support for Go's `-short` flag to skip tests taking >2 seconds. This enables faster feedback during development while preserving comprehensive testing in CI.

**Changes:**
- Add `SkipIfShort()` helper function in tests/preconditions.go
- Add `short` field to YAML test case schema (defaults to true)
- Mark 13 Go tests with `SkipIfShort()` (Git ops, vendor pulls, binary builds, Terraform, AWS SDK)
- Mark 9 YAML tests with `short: false` (vendor pulls requiring network I/O)
- Add `make test-short` and `make test-short-cover` targets
- Update CLAUDE.md and tests/README.md with usage examples
- Add AWS profile preconditions to 2 tests that require credentials

**Performance:**
- Quick tests: ~2m30s (skips 30+ seconds of long tests)
- Full tests: ~3m+ (runs all tests including long ones)

**Usage:**
```bash
make test-short              # Quick tests only
make testacc                 # All tests including long ones
go test -short ./...         # Direct Go command
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 8, 2025

Copy link
Copy Markdown

These changes were released in v1.194.0.

Erik Osterman (Cloud Posse) (osterman) added a commit that referenced this pull request Jul 11, 2026
… CLAUDE.md

internal/exec/describe_affected_test.go's shared setup helpers
(setupDescribeAffectedTest, setupDescribeAffectedTestWithFixture) copy the
entire repo into a tempdir for each of 11 tests, and the copy's exclude
filter never accounted for this repo's own gitignored build output
(build/, custom-gcl, website/build - ~820MB combined), nor did these tests
respect the testing.Short() convention the rest of the package already uses
(introduced in #1605). Add a short-mode skip to both helpers and extend the
exclude filter to skip those three paths. Measured: `go test ./internal/exec/...`
178s (was ~600s), `go test -short ./internal/exec/...` ~60s.

CLAUDE.md's "Essential Commands"/"Testing"/"Pre-commit"/"Compilation" sections
were accidentally reverted from atmos custom commands back to the old, now-dead
`make ...` targets (which just print a migration notice and exit 1) by an
unrelated PR. Restore the correct `atmos build`/`atmos test`/`atmos test --full`/
`atmos test --coverage`/`atmos lint --changed` references (verified against
.atmos.d/test.yaml and .atmos.d/lint.yaml), and change the mandatory
post-change check from an unscoped `go test ./...` to short-mode `atmos test`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Andriy Knysh (aknysh) added a commit that referenced this pull request Jul 12, 2026
#2715)

* feat(vendor): add vendor update/diff, archived-repo detection, component.yaml support

Closes the guess-and-hand-edit workflow for bumping vendored components: `atmos
vendor update` checks Git-backed sources for newer versions (honoring semver
constraints) and writes the new version in place via the format-preserving
pkg/yaml engine, and `atmos vendor diff` shows the diff between two versions
with no local checkout. Both now work against per-component component.yaml
manifests (not just vendor.yaml), detect archived upstream repos, respect
vendor.base_path/--chdir, and gained a spinner/progress UI with a tabular
update report.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(vendor): address CodeRabbit review findings on vendor update/diff PR

- Guard against a nil UpdateReport before calling UpdatedCount(): reachable
  when the user quits the spinner (keypress) before the background update
  finishes, which previously panicked with --pull set.
- Reset --stack/--tags before delegating to `vendor pull` on the
  single-component --pull path, matching the repo-wide path, so they don't
  trip validateVendorFlags' component/stack and component/tags exclusivity.
- Wrap ExecuteComponentVendorPullBatch's per-component resolution errors with
  the failing component's name so multi-component --pull failures are
  debuggable.
- Split the spinner's progress/done channel so a still-buffered progress
  message can no longer cause the terminal updateDoneMsg to be dropped,
  which hung the spinner forever waiting on a message that would never arrive.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(vendor): fix CI acceptance test failures on vendor update/diff PR

- atmos_vendor_pull: a PTY opened without Setsize (as the acceptance test
  harness's simulateTtyCommand does) reports size 0x0. maskedWriter.Fd()
  (this PR's own pkg/io/streams.go change) makes bubbletea's WindowSizeMsg
  reach the vendor-pull spinner again, and its handler was unconditionally
  adopting that 0x0, overwriting the already-correct fallback width and
  truncating "Pulling <name>" down to a bare ellipsis for the whole run.
  Guard both initialModelWidth and the WindowSizeMsg handler against
  non-positive widths, with a regression test reproducing the exact failure.
- atmos_toolchain_info_shows_atmos-inline_registry / raw_format_tool: this
  PR's indicator-column width fix (cmd/version/formatters.go,
  pkg/toolchain/info.go) legitimately changes table column widths;
  regenerate only the affected table rows in the two golden snapshots.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* test(vendor): raise patch coverage on vendor update/diff PR, fix mixin-failure summary bug

Coverage additions target this PR's actual diff (verified against `git diff
origin/main` line ranges, not whole-file coverage):
- cmd/vendor/update_spinner.go: Init/Update/waitForUpdateMsg (0% -> 100%) and
  runUpdateWithSpinner's TTY branch (12% -> 88%), driven directly as a
  bubbletea tea.Model plus one real-PTY end-to-end test.
- cmd/vendor/update.go: single-component runVendorPull path, resetUnchangedFlag,
  and the typeChanged branch.
- pkg/vendoring/resolve.go: DefaultComponentDirResolver's real (non-fake)
  path, VendorFilePresent's remaining branches, notFoundError, and
  DiscoverComponentManifests/DiscoverAllComponentManifests error paths.
- internal/exec/vendor_component_utils.go: ExecuteComponentVendorInternal
  (previously untested directly) and buildComponentVendorPackages' template/
  mixin error branches.
- pkg/vendoring/update.go, archived.go, pkg/io/streams.go,
  cmd/vendor/update_report.go: remaining small diff-relevant gaps.

Also fixes a real bug found while extending vendor_model_test.go's mixin
coverage: a mixin-only failure (component itself succeeds) rendered as
"Failed to vendor 0 components" in both the TTY and non-TTY summaries,
indistinguishable from full success even though vendorFailureError still
fails the command. Both summaries now say so explicitly ("Failed to vendor N
mixins").

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(vendor): batch component.yaml pulls by component type, not just basename

partitionUpdatedResults grouped every component.yaml-declared update into one
ExecuteComponentVendorPullBatch call regardless of type, but
DiscoverAllComponentManifests' repo-wide sweep (no explicit --type) can mix
terraform/helmfile/packer updates in a single report. Forwarding a mixed
batch under one componentType resolved non-matching types under the wrong
components/<type>/<name> path.

Thread ComponentType through ResolvedSource and SourceUpdateResult (set by
ResolveComponentSource's component.yaml fallback and
DiscoverComponentManifests/DiscoverAllComponentManifests, empty for
vendor.yaml-declared sources) and group the batch by it, calling
ExecuteComponentVendorPullBatch once per type. Added a regression test
(TestRunVendorPull_BatchesByComponentType) that reproduces the wrong-path
failure without the fix and passes with it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* perf(test): skip full-repo copy in short mode; fix stale make refs in CLAUDE.md

internal/exec/describe_affected_test.go's shared setup helpers
(setupDescribeAffectedTest, setupDescribeAffectedTestWithFixture) copy the
entire repo into a tempdir for each of 11 tests, and the copy's exclude
filter never accounted for this repo's own gitignored build output
(build/, custom-gcl, website/build - ~820MB combined), nor did these tests
respect the testing.Short() convention the rest of the package already uses
(introduced in #1605). Add a short-mode skip to both helpers and extend the
exclude filter to skip those three paths. Measured: `go test ./internal/exec/...`
178s (was ~600s), `go test -short ./internal/exec/...` ~60s.

CLAUDE.md's "Essential Commands"/"Testing"/"Pre-commit"/"Compilation" sections
were accidentally reverted from atmos custom commands back to the old, now-dead
`make ...` targets (which just print a migration notice and exit 1) by an
unrelated PR. Restore the correct `atmos build`/`atmos test`/`atmos test --full`/
`atmos test --coverage`/`atmos lint --changed` references (verified against
.atmos.d/test.yaml and .atmos.d/lint.yaml), and change the mandatory
post-change check from an unscoped `go test ./...` to short-mode `atmos test`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(vendor): skip two new tests on Windows for platform-specific behavior

- TestRunUpdateWithSpinner_TTY_RunsSpinnerAndReturnsResult: creack/pty.Open()
  returns "unsupported" on Windows, matching the existing PTY-skip precedent
  in pkg/io/streams_test.go.
- TestDiscoverComponentManifests_BasePathIsAFile: os.ReadDir on a regular
  file path doesn't return an error on Windows (unlike ENOTDIR on Unix),
  so the test's premise doesn't hold there.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(docs): fix broken floci.io link in quick-start-advanced README

examples/quick-start-advanced/README.md linked https://floci.io/ for Floci,
which now 404s. Every other Floci reference in the repo (docs/prd/emulators.md,
examples/terraform-tests/README.md, examples/emulator-aws/README.md) already
points at https://github.com/floci-io/floci; fix the one inconsistent link to
match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Andriy Knysh <aknysh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants