mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-22 23:26:39 -08:00
refactor: use google/wire for cache (#7024)
Signed-off-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
24
pkg/cache/remote_test.go
vendored
24
pkg/cache/remote_test.go
vendored
@@ -145,7 +145,11 @@ func TestRemoteCache_PutArtifact(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := cache.NewRemoteCache(ts.URL, tt.args.customHeaders, false)
|
||||
c := cache.NewRemoteCache(cache.RemoteOptions{
|
||||
ServerAddr: ts.URL,
|
||||
CustomHeaders: tt.args.customHeaders,
|
||||
Insecure: false,
|
||||
})
|
||||
err := c.PutArtifact(tt.args.imageID, tt.args.imageInfo)
|
||||
if tt.wantErr != "" {
|
||||
require.Error(t, err, tt.name)
|
||||
@@ -206,7 +210,11 @@ func TestRemoteCache_PutBlob(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := cache.NewRemoteCache(ts.URL, tt.args.customHeaders, false)
|
||||
c := cache.NewRemoteCache(cache.RemoteOptions{
|
||||
ServerAddr: ts.URL,
|
||||
CustomHeaders: tt.args.customHeaders,
|
||||
Insecure: false,
|
||||
})
|
||||
err := c.PutBlob(tt.args.diffID, tt.args.layerInfo)
|
||||
if tt.wantErr != "" {
|
||||
require.Error(t, err, tt.name)
|
||||
@@ -284,7 +292,11 @@ func TestRemoteCache_MissingBlobs(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := cache.NewRemoteCache(ts.URL, tt.args.customHeaders, false)
|
||||
c := cache.NewRemoteCache(cache.RemoteOptions{
|
||||
ServerAddr: ts.URL,
|
||||
CustomHeaders: tt.args.customHeaders,
|
||||
Insecure: false,
|
||||
})
|
||||
gotMissingImage, gotMissingLayerIDs, err := c.MissingBlobs(tt.args.imageID, tt.args.layerIDs)
|
||||
if tt.wantErr != "" {
|
||||
require.Error(t, err, tt.name)
|
||||
@@ -334,7 +346,11 @@ func TestRemoteCache_PutArtifactInsecure(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := cache.NewRemoteCache(ts.URL, nil, tt.args.insecure)
|
||||
c := cache.NewRemoteCache(cache.RemoteOptions{
|
||||
ServerAddr: ts.URL,
|
||||
CustomHeaders: nil,
|
||||
Insecure: tt.args.insecure,
|
||||
})
|
||||
err := c.PutArtifact(tt.args.imageID, tt.args.imageInfo)
|
||||
if tt.wantErr != "" {
|
||||
require.Error(t, err)
|
||||
|
||||
Reference in New Issue
Block a user