Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/attestation/crafter/crafter_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2023-2025 The Chainloop Authors.
// Copyright 2023-2026 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,6 +40,7 @@ import (
"github.com/go-git/go-git/v6/config"
"github.com/go-git/go-git/v6/plumbing/object"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"google.golang.org/protobuf/encoding/protojson"
Expand Down Expand Up @@ -609,7 +610,7 @@ func (s *crafterSuite) TestAddMaterialsAutomatic() {
uploader := mUploader.NewUploader(s.T())

if !tc.uploadArtifact {
uploader.On("UploadFile", context.Background(), tc.materialPath).
uploader.On("Upload", context.Background(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "simple.txt",
Expand Down
3 changes: 2 additions & 1 deletion pkg/attestation/crafter/materials/artifact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -76,7 +77,7 @@ func TestArtifactCraft(t *testing.T) {

// Mock uploader
uploader := mUploader.NewUploader(t)
uploader.On("UploadFile", context.TODO(), "./testdata/simple.txt").
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "simple.txt",
Expand Down
5 changes: 3 additions & 2 deletions pkg/attestation/crafter/materials/asyncapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -143,7 +144,7 @@ func TestAsyncAPICraft(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "spec.json",
Expand Down Expand Up @@ -178,7 +179,7 @@ func TestAsyncAPICraft(t *testing.T) {
func TestAsyncAPICraftNoStrictValidation(t *testing.T) {
l := zerolog.Nop()
uploader := mUploader.NewUploader(t)
uploader.On("UploadFile", context.TODO(), "./testdata/asyncapi-invalid.json").
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "spec.json",
Expand Down
4 changes: 2 additions & 2 deletions pkg/attestation/crafter/materials/attestation_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2024-2025 The Chainloop Authors.
// Copyright 2024-2026 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -136,7 +136,7 @@ func TestAttestationCraft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if !tc.expectErr {
uploader.On("UploadFile", context.Background(), mock.Anything).
uploader.On("Upload", context.Background(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "attestation.json",
Expand Down
5 changes: 3 additions & 2 deletions pkg/attestation/crafter/materials/blackduck_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2024-2025 The Chainloop Authors.
// Copyright 2024-2026 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -26,6 +26,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -77,7 +78,7 @@ func TestBlackduckJSONCraft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{}, nil)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -288,7 +289,7 @@ func TestChainloopAIAgentConfigCrafter_AgentNameAnnotation(t *testing.T) {
}

uploader := mUploader.NewUploader(t)
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: tc.filePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -327,7 +328,7 @@ func TestChainloopAICodingSessionCrafter_Annotations(t *testing.T) {
}

uploader := mUploader.NewUploader(t)
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: tc.filePath,
Expand Down
3 changes: 2 additions & 1 deletion pkg/attestation/crafter/materials/csaf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -220,7 +221,7 @@ func TestCSAFCraft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "vex.json",
Expand Down
7 changes: 4 additions & 3 deletions pkg/attestation/crafter/materials/cyclonedxjson_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -212,7 +213,7 @@ func TestCyclonedxJSONCraft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{}, nil)
}

Expand Down Expand Up @@ -304,7 +305,7 @@ func TestCycloneDXJSONCraftNoStrictValidation(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{}, nil)
}

Expand Down Expand Up @@ -358,7 +359,7 @@ func TestCycloneDXJSONCraft_SkipUpload(t *testing.T) {
// Mock uploader - only expect upload call if not skipped
uploader := mUploader.NewUploader(t)
if tc.wantUpload {
uploader.On("UploadFile", context.TODO(), filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "sbom.cyclonedx.json",
Expand Down
5 changes: 3 additions & 2 deletions pkg/attestation/crafter/materials/evidence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -76,7 +77,7 @@ func TestEvidenceCraft(t *testing.T) {

// Mock uploader
uploader := mUploader.NewUploader(t)
uploader.On("UploadFile", context.TODO(), "./testdata/simple.txt").
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "simple.txt",
Expand Down Expand Up @@ -213,7 +214,7 @@ func TestEvidenceCraftWithJSONAnnotations(t *testing.T) {

// Create a new mock uploader for each test case
uploader := mUploader.NewUploader(t)
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: tc.filePath,
Expand Down
9 changes: 5 additions & 4 deletions pkg/attestation/crafter/materials/ghas_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2024-2025 The Chainloop Authors.
// Copyright 2024-2026 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +27,7 @@ import (

"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -105,7 +106,7 @@ func TestGHASCodeScanCraft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "ghas-code-scan.json",
Expand Down Expand Up @@ -177,7 +178,7 @@ func TestGHASSecretScanCraft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "ghas-secret-scan.json",
Expand Down Expand Up @@ -249,7 +250,7 @@ func TestGHASDependencyScanCraft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "ghas-dependency-scan.json",
Expand Down
5 changes: 3 additions & 2 deletions pkg/attestation/crafter/materials/gitlab_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2023-2025 The Chainloop Authors.
// Copyright 2023-2026 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -25,6 +25,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -129,7 +130,7 @@ func TestGitlabCrafter_Craft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{}, nil)
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/attestation/crafter/materials/gitleaks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -111,7 +112,7 @@ func TestGitleaksReportCrafter_Craft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{}, nil)
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/attestation/crafter/materials/graphql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -118,7 +119,7 @@ func TestGraphQLCraft(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "schema.graphql",
Expand Down
5 changes: 3 additions & 2 deletions pkg/attestation/crafter/materials/helmchart_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2024-2025 The Chainloop Authors.
// Copyright 2024-2026 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -26,6 +26,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -121,7 +122,7 @@ func TestHelmChartCraft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{}, nil)
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/attestation/crafter/materials/jacoco_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2023-2025 The Chainloop Authors.
// Copyright 2023-2026 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +27,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -68,7 +69,7 @@ func TestJacocoCraft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "jacoco.xml",
Expand Down
5 changes: 3 additions & 2 deletions pkg/attestation/crafter/materials/junit_xml_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2023-2025 The Chainloop Authors.
// Copyright 2023-2026 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,6 +28,7 @@ import (
mUploader "github.com/chainloop-dev/chainloop/pkg/casclient/mocks"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -111,7 +112,7 @@ func TestJUnitXMLCraft(t *testing.T) {
// Mock uploader
uploader := mUploader.NewUploader(t)
if tc.wantErr == "" {
uploader.On("UploadFile", context.TODO(), tc.filePath).
uploader.On("Upload", context.TODO(), mock.Anything, mock.Anything, mock.Anything).
Return(&casclient.UpDownStatus{
Digest: "deadbeef",
Filename: "test.xml",
Expand Down
Loading
Loading