mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-23 07:29:00 -08:00
fix test
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestExtract(t *testing.T) {
|
func TestExtractFromFile(t *testing.T) {
|
||||||
vectors := []struct {
|
vectors := []struct {
|
||||||
file string // Test input file
|
file string // Test input file
|
||||||
filenames []string // Target files
|
filenames []string // Target files
|
||||||
@@ -52,7 +52,7 @@ func TestExtract(t *testing.T) {
|
|||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
d := DockerExtractor{}
|
d := DockerExtractor{}
|
||||||
fm, err := d.Extract(f, v.filenames)
|
fm, err := d.ExtractFromFile(nil, f, v.filenames)
|
||||||
if v.err != err {
|
if v.err != err {
|
||||||
t.Errorf("err: got %v, want %v", v.err, err)
|
t.Errorf("err: got %v, want %v", v.err, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/prometheus/common/log"
|
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"log"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ecr"
|
"github.com/aws/aws-sdk-go/service/ecr"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
@@ -34,7 +34,7 @@ func GetToken(ctx context.Context, auth types.AuthConfig) types.AuthConfig {
|
|||||||
username, password, err = GetGCRAuthorizationToken(ctx)
|
username, password, err = GetGCRAuthorizationToken(ctx)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugf("failed to get token: %w", err)
|
log.Printf("failed to get token: %s", err)
|
||||||
}
|
}
|
||||||
auth.Username = username
|
auth.Username = username
|
||||||
auth.Password = password
|
auth.Password = password
|
||||||
|
|||||||
Reference in New Issue
Block a user