mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
unblock timeout for power-user select CLI tests (#985)
* update to use shared secretsFixture to prevent race Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
This commit is contained in:
parent
2fc344aba4
commit
d2f053bc71
@ -6,6 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestPowerUserCmdFlags(t *testing.T) {
|
func TestPowerUserCmdFlags(t *testing.T) {
|
||||||
|
secretsFixture := getFixtureImage(t, "image-secrets")
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
args []string
|
args []string
|
||||||
@ -32,30 +33,9 @@ func TestPowerUserCmdFlags(t *testing.T) {
|
|||||||
assertSuccessfulReturnCode,
|
assertSuccessfulReturnCode,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "defaut-secrets-results-w-reveal-values",
|
|
||||||
env: map[string]string{
|
|
||||||
"SYFT_SECRETS_REVEAL_VALUES": "true",
|
|
||||||
},
|
|
||||||
args: []string{"power-user", "docker-archive:" + getFixtureImage(t, "image-secrets")},
|
|
||||||
assertions: []traitAssertion{
|
|
||||||
assertInOutput(`"classification": "generic-api-key"`), // proof of the secrets cataloger finding something
|
|
||||||
assertInOutput(`"12345A7a901b345678901234567890123456789012345678901234567890"`), // proof of the secrets cataloger finding the api key
|
|
||||||
assertSuccessfulReturnCode,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "default-secret-results-dont-reveal-values",
|
|
||||||
args: []string{"power-user", "docker-archive:" + getFixtureImage(t, "image-secrets")},
|
|
||||||
assertions: []traitAssertion{
|
|
||||||
assertInOutput(`"classification": "generic-api-key"`), // proof of the secrets cataloger finding something
|
|
||||||
assertNotInOutput(`"12345A7a901b345678901234567890123456789012345678901234567890"`), // proof of the secrets cataloger finding the api key
|
|
||||||
assertSuccessfulReturnCode,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "content-cataloger-wired-up",
|
name: "content-cataloger-wired-up",
|
||||||
args: []string{"power-user", "docker-archive:" + getFixtureImage(t, "image-secrets")},
|
args: []string{"power-user", "docker-archive:" + secretsFixture},
|
||||||
env: map[string]string{
|
env: map[string]string{
|
||||||
"SYFT_FILE_CONTENTS_GLOBS": "/api-key.txt",
|
"SYFT_FILE_CONTENTS_GLOBS": "/api-key.txt",
|
||||||
},
|
},
|
||||||
@ -75,12 +55,33 @@ func TestPowerUserCmdFlags(t *testing.T) {
|
|||||||
assertSuccessfulReturnCode,
|
assertSuccessfulReturnCode,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "default-secrets-results-w-reveal-values",
|
||||||
|
env: map[string]string{
|
||||||
|
"SYFT_SECRETS_REVEAL_VALUES": "true",
|
||||||
|
},
|
||||||
|
args: []string{"power-user", "docker-archive:" + secretsFixture},
|
||||||
|
assertions: []traitAssertion{
|
||||||
|
assertInOutput(`"classification": "generic-api-key"`), // proof of the secrets cataloger finding something
|
||||||
|
assertInOutput(`"12345A7a901b345678901234567890123456789012345678901234567890"`), // proof of the secrets cataloger finding the api key
|
||||||
|
assertSuccessfulReturnCode,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "default-secret-results-dont-reveal-values",
|
||||||
|
args: []string{"power-user", "docker-archive:" + secretsFixture},
|
||||||
|
assertions: []traitAssertion{
|
||||||
|
assertInOutput(`"classification": "generic-api-key"`), // proof of the secrets cataloger finding something
|
||||||
|
assertNotInOutput(`"12345A7a901b345678901234567890123456789012345678901234567890"`), // proof of the secrets cataloger finding the api key
|
||||||
|
assertSuccessfulReturnCode,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "default-secrets-dir-results-w-reveal-values",
|
name: "default-secrets-dir-results-w-reveal-values",
|
||||||
env: map[string]string{
|
env: map[string]string{
|
||||||
"SYFT_SECRETS_REVEAL_VALUES": "true",
|
"SYFT_SECRETS_REVEAL_VALUES": "true",
|
||||||
},
|
},
|
||||||
args: []string{"power-user", "dir:test-fixtures/image-secrets"},
|
args: []string{"power-user", "dir:test-fixtures/image-secrets-dir"},
|
||||||
assertions: []traitAssertion{
|
assertions: []traitAssertion{
|
||||||
assertInOutput(`"classification": "generic-api-key"`), // proof of the secrets cataloger finding something
|
assertInOutput(`"classification": "generic-api-key"`), // proof of the secrets cataloger finding something
|
||||||
assertInOutput(`"12345A7a901b345678901234567890123456789012345678901234567890"`), // proof of the secrets cataloger finding the api key
|
assertInOutput(`"12345A7a901b345678901234567890123456789012345678901234567890"`), // proof of the secrets cataloger finding the api key
|
||||||
|
|||||||
2
test/cli/test-fixtures/image-secrets-dir/Dockerfile
Normal file
2
test/cli/test-fixtures/image-secrets-dir/Dockerfile
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
FROM scratch
|
||||||
|
ADD api-key.txt .
|
||||||
1
test/cli/test-fixtures/image-secrets-dir/api-key.txt
Normal file
1
test/cli/test-fixtures/image-secrets-dir/api-key.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
some_ApI-kEy = "12345A7a901b345678901234567890123456789012345678901234567890"
|
||||||
Loading…
x
Reference in New Issue
Block a user