Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.sum|package-lock.json|^.secrets.baseline$",
"lines": null
},
"generated_at": "2025-10-20T10:17:18Z",
"generated_at": "2025-11-10T14:09:39Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -100,7 +100,7 @@
"hashed_secret": "69ec008056b3c76e2a24013e110c4818aaec593b",
"is_secret": false,
"is_verified": false,
"line_number": 41,
"line_number": 53,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -182,23 +182,23 @@
"hashed_secret": "892bd503fb45f6fcafb1c7003d88291fc0b20208",
"is_secret": false,
"is_verified": false,
"line_number": 473,
"line_number": 504,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "5da5a31d49370df43eff521b39c10db1466fae44",
"is_secret": false,
"is_verified": false,
"line_number": 476,
"line_number": 509,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030",
"is_secret": false,
"is_verified": false,
"line_number": 694,
"line_number": 727,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down
77 changes: 77 additions & 0 deletions cloudinfo/catalog_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,3 +406,80 @@ func (m *MockCloudInfoServiceForPermutation) IsCacheEnabled() bool {
args := m.Called()
return args.Bool(0)
}

// Schematics methods added during migration
func (m *MockCloudInfoServiceForPermutation) CreateSchematicsWorkspace(name string, resourceGroup string, region string, templateFolder string, terraformVersion string, tags []string, envVars []map[string]interface{}, envMetadata []schematicsv1.EnvironmentValuesMetadata) (*schematicsv1.WorkspaceResponse, error) {
args := m.Called(name, resourceGroup, region, templateFolder, terraformVersion, tags, envVars, envMetadata)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*schematicsv1.WorkspaceResponse), args.Error(1)
}

func (m *MockCloudInfoServiceForPermutation) DeleteSchematicsWorkspace(workspaceID string, location string, destroyResources bool) (string, error) {
args := m.Called(workspaceID, location, destroyResources)
return args.String(0), args.Error(1)
}

func (m *MockCloudInfoServiceForPermutation) UploadTarToSchematicsWorkspace(workspaceID string, templateID string, tarPath string, location string) error {
args := m.Called(workspaceID, templateID, tarPath, location)
return args.Error(0)
}

func (m *MockCloudInfoServiceForPermutation) UpdateSchematicsWorkspaceVariables(workspaceID string, templateID string, variables []schematicsv1.WorkspaceVariableRequest, location string) error {
args := m.Called(workspaceID, templateID, variables, location)
return args.Error(0)
}

func (m *MockCloudInfoServiceForPermutation) CreateSchematicsPlanJob(workspaceID string, location string) (*schematicsv1.WorkspaceActivityPlanResult, error) {
args := m.Called(workspaceID, location)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*schematicsv1.WorkspaceActivityPlanResult), args.Error(1)
}

func (m *MockCloudInfoServiceForPermutation) CreateSchematicsApplyJob(workspaceID string, location string) (*schematicsv1.WorkspaceActivityApplyResult, error) {
args := m.Called(workspaceID, location)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*schematicsv1.WorkspaceActivityApplyResult), args.Error(1)
}

func (m *MockCloudInfoServiceForPermutation) CreateSchematicsDestroyJob(workspaceID string, location string) (*schematicsv1.WorkspaceActivityDestroyResult, error) {
args := m.Called(workspaceID, location)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*schematicsv1.WorkspaceActivityDestroyResult), args.Error(1)
}

func (m *MockCloudInfoServiceForPermutation) WaitForSchematicsJobCompletion(workspaceID string, jobID string, location string, timeoutMinutes int) (string, error) {
args := m.Called(workspaceID, jobID, location, timeoutMinutes)
return args.String(0), args.Error(1)
}

func (m *MockCloudInfoServiceForPermutation) GetSchematicsWorkspaceJobDetail(workspaceID string, jobID string, location string) (*schematicsv1.WorkspaceActivity, error) {
args := m.Called(workspaceID, jobID, location)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*schematicsv1.WorkspaceActivity), args.Error(1)
}

func (m *MockCloudInfoServiceForPermutation) FindLatestSchematicsJobByName(workspaceID string, jobName string, location string) (*schematicsv1.WorkspaceActivity, error) {
args := m.Called(workspaceID, jobName, location)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*schematicsv1.WorkspaceActivity), args.Error(1)
}

func (m *MockCloudInfoServiceForPermutation) GetSchematicsWorkspaceOutputs(workspaceID string, location string) (map[string]interface{}, error) {
args := m.Called(workspaceID, location)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(map[string]interface{}), args.Error(1)
}
12 changes: 12 additions & 0 deletions cloudinfo/iam_authenticator_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"net/http"
"testing"

"github.com/IBM/go-sdk-core/v5/core"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -35,6 +36,17 @@ func (a *MockAuthenticator) Validate() error {
return nil
}

// RequestToken returns a mock IAM token response for testing
func (a *MockAuthenticator) RequestToken() (*core.IamTokenServerResponse, error) {
return &core.IamTokenServerResponse{
AccessToken: a.Token,
RefreshToken: "mock-refresh-token",
TokenType: "Bearer",
ExpiresIn: 3600,
Expiration: 0,
}, nil
}

func TestMockAuthenticator(t *testing.T) {
// Create a new MockAuthenticator with a test token
mockToken := "test-mock-token"
Expand Down
9 changes: 8 additions & 1 deletion cloudinfo/iam_authenticator_types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package cloudinfo

import "net/http"
import (
"net/http"

"github.com/IBM/go-sdk-core/v5/core"
)

// IiamAuthenticator defines the interface for authentication that can be implemented
// by both the real authenticator and test mocks.
Expand All @@ -17,6 +21,9 @@ type IiamAuthenticator interface {

// Validate checks if the authenticator is properly configured
Validate() error

// RequestToken requests a new IAM token from the token server
RequestToken() (*core.IamTokenServerResponse, error)
}

// Making the CoreAuthenticator an alias of the implementation from IBM SDK
Expand Down
13 changes: 13 additions & 0 deletions cloudinfo/ref_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,19 @@ func (m *MockTokenTrackingAuthenticator) Validate() error {
return nil
}

func (m *MockTokenTrackingAuthenticator) RequestToken() (*core.IamTokenServerResponse, error) {
if m.TokenRefreshCallback != nil {
m.TokenRefreshCallback()
}
return &core.IamTokenServerResponse{
AccessToken: "mock-token-" + m.ApiKey,
RefreshToken: "mock-refresh-token",
TokenType: "Bearer",
ExpiresIn: 3600,
Expiration: 0,
}, nil
}

// Tests for transformStackStyleReference
func TestTransformStackStyleReference(t *testing.T) {
projectInfo := &ProjectInfo{
Expand Down
Loading