Skip to content

Add regression test for 'ds-records create' exit code #44

@ggalmazor

Description

@ggalmazor

Description

Follow-up from #20. That bug caused dnsimple domains ds-records create to exit 1 and print Error: Failed to create DS record. Please contact support while the record was actually being persisted server-side. The underlying cause was fixed in the API, but the CLI itself has no test that would catch a future recurrence of the same exit-code-vs-side-effect divergence on this command.

The CLI is a thin wrapper (internal/cli/domains_ds_records.go, newDsRecordsCreateCmd) that simply propagates errors from c.Domains.CreateDelegationSignerRecord(...). A small integration-style test that exercises the happy path (stubbed or sandbox-backed) and asserts exit code 0 with no Error: line on stderr would have caught the original regression immediately and would protect the next DS-records callers (automation, CI scripts) from silent exit-code breakage.

Expected Behavior or Outcome

  • A regression test exists for the ds-records create command that fails if the command exits non-zero on a successful create.
  • The test runs in CI on every PR.
  • The test is written in a style that is straightforward to replicate for the sibling DS-records subcommands (list, delete) if they gain similar coverage later.

Acceptance Criteria

  • A test exercises dnsimple domains ds-records create against a stubbed/fake DNSimple API that responds with a 2xx and a valid DS record body, and asserts the command exits with code 0.
  • The test asserts that no line starting with Error: is emitted on stderr for the happy path.
  • The test runs as part of the default go test ./... (or equivalent CI invocation) and does not require any out-of-band setup beyond what other CLI tests already require.
  • The test is documented briefly in its file header so a reader understands what regression it guards.

Resources/References

Notes

Exit-code correctness is the load-bearing property here. The assertion does not need to validate output formatting beyond "no error line"; stricter assertions on the exact stdout shape can live in a separate, more focused test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions