oras-project / oras

OCI registry client - managing content like artifacts, images, packages
https://oras.land
Apache License 2.0
1.44k stars 174 forks source link

Create a mock console to increase test coverage on mac #1461

Open TerryHowe opened 2 months ago

TerryHowe commented 2 months ago

What is the version of your ORAS CLI

1.2.0

What would you like to be added?

Increase test coverage on mac with mock console

Why is this needed for ORAS?

These tests do not run on mac because of X-code issue:

 % grep -r solaris cmd internal 
cmd/oras/internal/option/common_unix_test.go://go:build freebsd || linux || netbsd || openbsd || solaris
cmd/oras/internal/display/status/track/target_test.go://go:build freebsd || linux || netbsd || openbsd || solaris
cmd/oras/internal/display/status/progress/manager_test.go://go:build freebsd || linux || netbsd || openbsd || solaris
cmd/oras/internal/display/status/progress/status_test.go://go:build freebsd || linux || netbsd || openbsd || solaris
cmd/oras/internal/display/status/tty_console_test.go://go:build freebsd || linux || netbsd || openbsd || solaris
cmd/oras/internal/display/status/console/console_test.go://go:build freebsd || linux || netbsd || openbsd || solaris
cmd/oras/internal/display/status/console/testutils/testutils.go://go:build freebsd || linux || netbsd || openbsd || solaris
cmd/oras/root/cp_test.go://go:build freebsd || linux || netbsd || openbsd || solaris
cmd/oras/root/blob/push_test.go://go:build freebsd || linux || netbsd || openbsd || solaris
cmd/oras/root/blob/fetch_test.go://go:build freebsd || linux || netbsd || openbsd || solaris

Are you willing to submit PRs to contribute to this feature?

qweeah commented 2 months ago

1) Where should be mac test be run? 2) How to merge the test coverage of mac with linux's? 3) What SDK should be used to mock the console test on mac?

TerryHowe commented 2 months ago
  1. I'm hoping that everything outside of cmd/oras/internal/display/status/progress would be tested on mac
  2. I was hoping that a layer would be created at progress package that could be mocked with dependency injection
  3. I was not planning on bringing in a package for mock, just go code.
github-actions[bot] commented 5 days ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

TerryHowe commented 4 days ago

Close to done. Related:

https://github.com/oras-project/oras/pull/1481 https://github.com/oras-project/oras/pull/1474 https://github.com/oras-project/oras/pull/1511