fix: ensure version output to stdout (#2621)

This commit is contained in:
Keith Zantow
2024-02-09 20:59:25 +00:00
committed by GitHub
parent 84576b93e1
commit d26a5c4d30
4 changed files with 27 additions and 25 deletions
+17 -16
View File
@@ -190,22 +190,23 @@ func TestPackagesCmdFlags(t *testing.T) {
assertSuccessfulReturnCode,
},
},
{
// TODO: this could be a unit test
name: "responds-to-package-cataloger-search-options",
args: []string{"--help"},
env: map[string]string{
"SYFT_PACKAGE_SEARCH_UNINDEXED_ARCHIVES": "true",
"SYFT_PACKAGE_SEARCH_INDEXED_ARCHIVES": "false",
},
assertions: []traitAssertion{
// the application config in the log matches that of what we expect to have been configured. Note:
// we are not testing further wiring of this option, only that the config responds to
// package-cataloger-level options.
assertInOutput("search-unindexed-archives: true"),
assertInOutput("search-indexed-archives: false"),
},
},
// TODO: uncomment this test when we can use `syft config`
//{
// // TODO: this could be a unit test
// name: "responds-to-package-cataloger-search-options",
// args: []string{"--help"},
// env: map[string]string{
// "SYFT_PACKAGE_SEARCH_UNINDEXED_ARCHIVES": "true",
// "SYFT_PACKAGE_SEARCH_INDEXED_ARCHIVES": "false",
// },
// assertions: []traitAssertion{
// // the application config in the log matches that of what we expect to have been configured. Note:
// // we are not testing further wiring of this option, only that the config responds to
// // package-cataloger-level options.
// assertInOutput("search-unindexed-archives: true"),
// assertInOutput("search-indexed-archives: false"),
// },
//},
{
name: "platform-option-wired-up",
args: []string{"scan", "--platform", "arm64", "-o", "json", "registry:busybox:1.31"},
+1
View File
@@ -14,6 +14,7 @@ func TestVersionCmdPrintsToStdout(t *testing.T) {
name: "version command prints to stdout",
assertions: []traitAssertion{
assertInOutput("Version:"),
assertNoStderr,
},
},
}