Skip to content

BREV-1585: add workbench integration test and actions workflow config#249

Merged
PreciselyAlyss merged 9 commits into
mainfrom
brev-1585
Aug 19, 2025
Merged

BREV-1585: add workbench integration test and actions workflow config#249
PreciselyAlyss merged 9 commits into
mainfrom
brev-1585

Conversation

@PreciselyAlyss

Copy link
Copy Markdown
Collaborator

https://linear.app/brevidia/issue/BREV-1580/add-test-to-brev-cli-for-workbench-integration

📋 Created Files:

1. CLI Output Compatibility Tests (pkg/integration/cli_output_compatibility_test.go)

  • Version Command Testing: Verifies brev --version outputs parseable X.Y.Z format
  • Organization Commands: Tests brev org ls table format and current org marking with "*"
  • Instance Listing: Tests brev ls table format with NAME, STATUS, ID, MACHINE columns
  • Command Existence: Verifies essential commands (refresh, org set, start, stop) exist
  • API Compatibility: Tests the /v1/instance/types endpoint format and response structure
  • Version Parsing Logic: Tests the exact version comparison logic external tools use

2. GitHub Actions Workflow (.github/workflows/cli-output-compatibility.yml)

  • Runs on: Push to main, pull requests, and manual dispatch
  • Environment: Ubuntu 22.04 with Go 1.22.6 (matching existing workflows)
  • Process: Builds binary, runs compatibility tests, provides detailed feedback
  • Merge Protection: Will fail CI if breaking changes are detected

🛡️ Protection Coverage:

The tests protect against breaking changes in:

Version output format - External tools parse Current Version: X.Y.Z
Org listing table - Column headers and current org marking
Instance listing table - Column positions and headers
Command availability - Core commands remain accessible
API response format - Instance types endpoint structure
Version comparison logic - Semantic version parsing compatibility

🔧 CI Integration:

  • Tests run automatically on every PR and main branch push
  • No authentication required - Tests focus on output format, not functionality
  • Fast execution - Lightweight tests that don't require external services
  • Clear failure messages - Guides developers on how to handle breaking changes
  • Merge rule ready - You can add this workflow as a required check

🎯 Next Steps:

  1. Add merge protection rule in GitHub settings to require this workflow to pass
  2. Test the workflow by creating a small PR to verify it runs correctly
  3. Coordinate with NVIDIA Workbench team - Share the test coverage so they know what's protected

This solution ensures that any changes to CLI output formats that external integrations depend on will be caught before they break downstream tools, while providing clear guidance to developers on how to handle intentional format changes.

@PreciselyAlyss

Copy link
Copy Markdown
Collaborator Author

Following this PR, I plan to update the branch protection rules

CleanShot 2025-07-22 at 16 59 33

@theFong theFong 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.

Useful even if just running locally with auth. Will need to figure out a way to auth to backend from CI

Comment thread pkg/integration/cli_output_compatibility_test.go Outdated
Comment thread pkg/integration/cli_output_compatibility_test.go Outdated
Comment thread pkg/integration/cli_output_compatibility_test.go
@codecov

codecov Bot commented Jul 25, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 12.54%. Comparing base (53896a9) to head (8a70a15).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #249      +/-   ##
==========================================
- Coverage   12.88%   12.54%   -0.34%     
==========================================
  Files         105      106       +1     
  Lines       12756    13098     +342     
==========================================
  Hits         1643     1643              
- Misses      10892    11234     +342     
  Partials      221      221              
Flag Coverage Δ
Linux 12.54% <ø> (-0.34%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@PreciselyAlyss

Copy link
Copy Markdown
Collaborator Author

@tylerfong or @theFong if either of you get a chance to re-review
sloth happy gif

@kjw3 kjw3 requested a review from tylerfong August 11, 2025 17:18
Comment thread .github/workflows/cli-output-compatibility.yml Outdated
Comment thread pkg/integration/cli_output_compatibility_test.go Outdated
}

// Test_OrgListCommandOutputFormat verifies that 'brev org ls' outputs parseable table format
func Test_OrgListCommandOutputFormat(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This test will effectively always be skipped since CI will not have a logged in user context. See here in the test output: https://github.com/brevdev/brev-cli/actions/runs/16530181989/job/46753395303?pr=249

I'm not sure if we handle this elsewhere in the CLI testing, but an approach could be to pass in a mock for the API calls such that we don't require auth since we are just validating the output. This isn't a trivial thing to figure out so I won't make this blocking haha

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, mocking the auth response would be my preferred approach. I think that would be better as a separate PR given the size of the changeset.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I could comment out the test, but this avoids the missed todo/refactor step. Happy to slice this up however makes sense

}

// Test_InstanceListCommandOutputFormat verifies that 'brev ls' outputs parseable table format
func Test_InstanceListCommandOutputFormat(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similarly, this test will always be skipped

@PreciselyAlyss PreciselyAlyss merged commit ce14db7 into main Aug 19, 2025
9 checks passed
@PreciselyAlyss PreciselyAlyss deleted the brev-1585 branch August 19, 2025 15:05
@PreciselyAlyss

Copy link
Copy Markdown
Collaborator Author

Was actually brev-1580 RIP

PreciselyAlyss added a commit that referenced this pull request Sep 16, 2025
…#249)

BREV-1585: add workbench integration test and actions workflow config
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.

4 participants