Skip to content

test(schedule): cover the one domain with no integration test - #591

Merged
retr0h merged 1 commit into
mainfrom
test/schedule-integration
Oct 4, 2026
Merged

retr0h merged 1 commit into
mainfrom
test/schedule-integration

Conversation

@retr0h

@retr0h retr0h commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

Closes #563. schedule had five operations and nothing exercising them end to end, the only domain in that position.

Three tests

TestScheduleList — the read-only smoke every other domain has. Proves the endpoint is reachable and answers in the collection shape.

TestScheduleValidationRejectsBeforeQueueing — a malformed cron expression, neither schedule nor interval, and a name the provider would refuse as a file name. The unit suites prove which rule fires; this proves the rejection survives the real CLI, the real client and the real middleware stack, and that the controller answers it rather than turning it into a job. Read-only despite naming create, because a request rejected at the API reaches no agent and changes nothing. That is the property being checked.

TestScheduleCreateGetUpdateDelete — one entry through all five operations, including a second delete for the idempotency the provider contract claims. The lifecycle is the only way to see that create's --object reference, the name the entry is addressed by afterwards, and delete's repeat behaviour agree with each other.

What CI actually gains

The lifecycle sits behind skipWriteOp like every write test in test/integration/, and CI runs just go-unit-int with no OSAPI_INTEGRATION_WRITES, so it does not run there. That is the existing convention, not something this PR introduces, but worth saying rather than implying coverage that is not there. The list and validation tests are what CI gains. The lifecycle runs on demand:

OSAPI_INTEGRATION_WRITE_SCHEDULE_LIFECYCLE=1 go test -tags integration -run TestScheduleSmokeSuite ./test/integration/

I ran it rather than leaving it unexercised

A test nobody has run is the thing this issue is about, so the lifecycle was run on Linux in a container:

--- PASS: TestScheduleSmokeSuite/TestScheduleCreateGetUpdateDelete (0.10s)
--- PASS: TestScheduleSmokeSuite/TestScheduleList
--- PASS: TestScheduleSmokeSuite/TestScheduleValidationRejectsBeforeQueueing

On Darwin the provider reports unsupported, which the provider contract makes a real outcome rather than a failure. The lifecycle now reads the first result's status after create and skips explicitly when it is skipped, instead of passing on assertions that could never have failed.

I also checked that get on a name that does not exist exits 1 with empty stdout, which is what makes s.Require().Equal(0, getCode) the real assertion rather than the Contains beside it.

One wrong turn, recorded because it nearly became a bug report

The first Linux run had every schedule job time out at the 30 second deadline, 500s, while the file endpoints beside them answered normally. That reads exactly like a dispatch bug in the one domain with no integration test, which would have been a tidy story.

It was my container. No /etc/machine-id, so the agent never started and answered nothing:

ERR failed to resolve agent identity component=agent error="resolve machine-id: read machine-id: open /etc/machine-id: no such file or directory"

The agent log said so plainly. Registration in cmd/agent_setup.go:297 is correct and the domain works.

Side finding, filed not fixed

#590 — every command under osapi client node schedule still describes itself as operating on "cron entries" in its help text, left over from #569. osapi client node schedule list --help says it lists cron entries. Two of the matches are correct and should stay, since they name the cron expression format rather than the domain.

just test passes, coverage 100%. Integration suite passes on both platforms.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c

schedule had five operations and nothing exercising them end to end,
the only domain in that position.

Three tests. The list smoke, matching every other domain's. A validation
test proving the controller answers a malformed request itself rather
than queueing it, which is read-only despite naming create: a request
rejected at the API never reaches an agent, and that is the property.
And a lifecycle walking one entry through all five operations, which is
the only way to see that create's object reference, the name the entry is
addressed by afterwards, and delete's idempotency agree.

The lifecycle sits behind skipWriteOp like every other write test here,
so it does not run in continuous integration. That is the existing
convention rather than something this adds, and worth saying plainly:
the list and validation tests are what CI gains.

Verified on Linux in a container rather than left unexercised, since a
test nobody has run is the thing this issue is about. On Darwin the
provider reports unsupported, so the lifecycle now skips explicitly
after create rather than passing on assertions that could not fail.

One wrong turn worth recording. The first Linux run had every schedule
job time out at the 30 second deadline while the file endpoints beside
them answered, which read exactly like a dispatch bug in the domain that
happens to have no integration test. It was the container: no
/etc/machine-id, so the agent never started and answered nothing. The
agent log said so. Reading it before filing anything is what kept a
bug report about my own environment out of the tracker.

Closes: #563
Refs: #590

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c
@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #591   +/-   ##
=======================================
  Coverage   99.95%   99.95%           
=======================================
  Files         501      501           
  Lines       24099    24099           
=======================================
  Hits        24089    24089           
  Misses         10       10           

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 732bcab...661614b. Read the comment docs.

🚀 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.

@retr0h
retr0h merged commit 3198487 into main Oct 4, 2026
12 checks passed
@retr0h
retr0h deleted the test/schedule-integration branch October 4, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

schedule is the only domain with no integration tests

1 participant