diff --git a/cmd/rekor-cli/app/search.go b/cmd/rekor-cli/app/search.go index 335d45034961b2899bd5d2e38f944c686d95ed7e..e447d235efdeed19fa6b327466b16bce4647ba3f 100644 --- a/cmd/rekor-cli/app/search.go +++ b/cmd/rekor-cli/app/search.go @@ -196,6 +196,10 @@ var searchCmd = &cobra.Command{ } } + if len(resp.Payload) == 0 { + return nil, fmt.Errorf("no matching entries found") + } + return &searchCmdOutput{ uuids: resp.GetPayload(), }, nil diff --git a/tests/e2e_test.go b/tests/e2e_test.go index a5f62a73e67f3b18bc908348652e285861a0eb00..c21079382b8b6fb16a8deea4ff73546dbb9bf510 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -226,6 +226,10 @@ func TestGet(t *testing.T) { outputContains(t, out, uuid) } +func TestSearchNoEntriesRC1(t *testing.T) { + runCliErr(t, "search", "--email", "noone@internetz.com") +} + func TestMinisign(t *testing.T) { // Create a keypair keyPath := filepath.Join(t.TempDir(), "minisign.key")