bug: spdx checksum empty array; allow syft to generate SHA1 for spdx-tag-value documents (#1404)

This commit is contained in:
Christopher Angelo Phillips
2022-12-20 00:10:35 +00:00
committed by GitHub
parent 8b38549b79
commit 0f1e8fca14
16 changed files with 967 additions and 636 deletions
+28
View File
@@ -1,8 +1,10 @@
package cli
import (
"bufio"
"bytes"
"fmt"
"io"
"math"
"os"
"os/exec"
@@ -14,9 +16,35 @@ import (
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/anchore/stereoscope/pkg/imagetest"
)
func runAndShow(t *testing.T, cmd *exec.Cmd) {
t.Helper()
stderr, err := cmd.StderrPipe()
require.NoErrorf(t, err, "could not get stderr: +v", err)
stdout, err := cmd.StdoutPipe()
require.NoErrorf(t, err, "could not get stdout: +v", err)
err = cmd.Start()
require.NoErrorf(t, err, "failed to start cmd: %+v", err)
show := func(label string, reader io.ReadCloser) {
scanner := bufio.NewScanner(reader)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
t.Logf("%s: %s", label, scanner.Text())
}
}
show("out", stdout)
show("err", stderr)
}
func setupPKI(t *testing.T, pw string) func() {
err := os.Setenv("COSIGN_PASSWORD", pw)
if err != nil {