Skip to content

Refactor CLI to make it testable using testscript#1426

Merged
hslatman merged 9 commits into
masterfrom
herman/testscript
Jun 17, 2025
Merged

Refactor CLI to make it testable using testscript#1426
hslatman merged 9 commits into
masterfrom
herman/testscript

Conversation

@hslatman

@hslatman hslatman commented May 22, 2025

Copy link
Copy Markdown
Member

This PR refactors the CLI and its integration tests to use the testscript package.

As part of that, this PR:

  • Refactors the existing integration tests to use the testscript DSL
  • Removes the integration build tag
  • Removes any notion of running integration tests; they're part of the usual test suite now

Coverage before:

coverprofile-treemap

Coverage after:

coverprofile-treemap(1)

Coverage data was created by running the tests with go-acc, and the visualization was created using go-cover-treemap. Coverage clearly increased in the parts of the code base that had existing integration tests and were refactored, but weren't included in code coverage before.

@github-actions github-actions Bot added the needs triage Waiting for discussion / prioritization by team label May 22, 2025
@hslatman
hslatman force-pushed the herman/testscript branch from 4fc2791 to b69ee0e Compare May 22, 2025 10:33
@hslatman hslatman added this to the v0.28.7 milestone May 26, 2025
@hslatman
hslatman force-pushed the herman/testscript branch 3 times, most recently from ae24576 to 4832304 Compare May 30, 2025 17:27
hslatman added 4 commits June 12, 2025 15:24
In CI the TTY is not available, and will result in this error:

`error reading password: error allocating terminal: open /dev/tty: no such device or address`

We prevent this by using the `--password-file` flag.
@hslatman
hslatman force-pushed the herman/testscript branch from 4832304 to 6de4059 Compare June 12, 2025 13:24
@hslatman
hslatman force-pushed the herman/testscript branch from 6de4059 to 298ff27 Compare June 12, 2025 13:31
@hslatman
hslatman force-pushed the herman/testscript branch from f229d6a to 1a494ce Compare June 12, 2025 23:00
@hslatman
hslatman marked this pull request as ready for review June 13, 2025 10:40
@hslatman
hslatman requested review from a team and maraino June 13, 2025 10:42
@hslatman
hslatman force-pushed the herman/testscript branch from eb550ee to 92a5eab Compare June 13, 2025 13:28
@hslatman
hslatman force-pushed the herman/testscript branch from 92a5eab to 2944159 Compare June 13, 2025 13:33

@maraino maraino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A few comments, and a rename of a couple of files.

Comment thread internal/cmd/main.go
Comment thread internal/cmd/main.go Outdated
Comment thread integration/certificate_test.go
Comment thread integration/testdata/certificate/sign.txtar Outdated
Comment thread integration/testdata/crypto/jwk-create-ec.txtar
Comment thread integration/testdata/crypto/jwt-sign.txtar
@hslatman
hslatman requested a review from maraino June 17, 2025 15:01
Comment thread integration/certificate_test.go
@hslatman
hslatman merged commit c791bbf into master Jun 17, 2025
15 checks passed
@hslatman
hslatman deleted the herman/testscript branch June 17, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs triage Waiting for discussion / prioritization by team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants