From f432f1e4b84bed909d0f7908d15af70dbf171aca Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Mon, 16 Dec 2024 09:16:47 -0800 Subject: [PATCH] still draft Signed-off-by: lakshmimsft --- pkg/cli/cmd/resourceprovider/create/create.go | 61 +------ pkg/cli/cmd/utils.go | 20 +++ .../v20231001preview/locations_fake_test.go | 149 ---------------- .../resourceproviders_fakes_test.go | 159 ------------------ .../resourcetypes_fake_test.go | 148 ---------------- pkg/ucp/ucpclient/registermanifests.go | 3 +- 6 files changed, 31 insertions(+), 509 deletions(-) delete mode 100644 pkg/ucp/api/v20231001preview/locations_fake_test.go delete mode 100644 pkg/ucp/api/v20231001preview/resourceproviders_fakes_test.go delete mode 100644 pkg/ucp/api/v20231001preview/resourcetypes_fake_test.go diff --git a/pkg/cli/cmd/resourceprovider/create/create.go b/pkg/cli/cmd/resourceprovider/create/create.go index b5c55b775f..771a409af3 100644 --- a/pkg/cli/cmd/resourceprovider/create/create.go +++ b/pkg/cli/cmd/resourceprovider/create/create.go @@ -19,8 +19,8 @@ package create import ( "context" - v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" "github.com/radius-project/radius/pkg/cli" + "github.com/radius-project/radius/pkg/cli/cmd" "github.com/radius-project/radius/pkg/cli/cmd/commonflags" "github.com/radius-project/radius/pkg/cli/cmd/resourceprovider/common" "github.com/radius-project/radius/pkg/cli/connections" @@ -28,8 +28,7 @@ import ( "github.com/radius-project/radius/pkg/cli/manifest" "github.com/radius-project/radius/pkg/cli/output" "github.com/radius-project/radius/pkg/cli/workspaces" - "github.com/radius-project/radius/pkg/to" - "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" + "github.com/radius-project/radius/pkg/ucp/ucpclient" "github.com/spf13/cobra" ) @@ -114,65 +113,23 @@ func (r *Runner) Validate(cmd *cobra.Command, args []string) error { // Run runs the `rad resource-provider create` command. func (r *Runner) Run(ctx context.Context) error { - client, err := r.ConnectionFactory.CreateApplicationsManagementClient(ctx, *r.Workspace) + + connection, err := cmd.GetConnection(ctx, r.Workspace) if err != nil { return err } - r.Output.LogInfo("Creating resource provider %s", r.ResourceProvider.Name) - _, err = client.CreateOrUpdateResourceProvider(ctx, "local", r.ResourceProvider.Name, &v20231001preview.ResourceProviderResource{ - Location: to.Ptr(v1.LocationGlobal), - Properties: &v20231001preview.ResourceProviderProperties{}, - }) + ucpclient, err := ucpclient.NewUCPClient(connection) if err != nil { return err } - // The location resource contains references to all of the resource types and API versions that the resource provider supports. - // We're instantiating the struct here so we can update it as we loop. - locationResource := v20231001preview.LocationResource{ - Properties: &v20231001preview.LocationProperties{ - ResourceTypes: map[string]*v20231001preview.LocationResourceType{}, - }, - } - - for resourceTypeName, resourceType := range r.ResourceProvider.Types { - r.Output.LogInfo("Creating resource type %s/%s", r.ResourceProvider.Name, resourceTypeName) - _, err := client.CreateOrUpdateResourceType(ctx, "local", r.ResourceProvider.Name, resourceTypeName, &v20231001preview.ResourceTypeResource{ - Properties: &v20231001preview.ResourceTypeProperties{ - DefaultAPIVersion: resourceType.DefaultAPIVersion, - }, - }) - if err != nil { - return err - } - - locationResourceType := &v20231001preview.LocationResourceType{ - APIVersions: map[string]map[string]any{}, - } - - for apiVersionName := range resourceType.APIVersions { - r.Output.LogInfo("Creating API Version %s/%s@%s", r.ResourceProvider.Name, resourceTypeName, apiVersionName) - _, err := client.CreateOrUpdateAPIVersion(ctx, "local", r.ResourceProvider.Name, resourceTypeName, apiVersionName, &v20231001preview.APIVersionResource{ - Properties: &v20231001preview.APIVersionProperties{}, - }) - if err != nil { - return err - } - - locationResourceType.APIVersions[apiVersionName] = map[string]any{} - } - - locationResource.Properties.ResourceTypes[resourceTypeName] = locationResourceType - } - - r.Output.LogInfo("Creating location %s/%s", r.ResourceProvider.Name, v1.LocationGlobal) - _, err = client.CreateOrUpdateLocation(ctx, "local", r.ResourceProvider.Name, v1.LocationGlobal, &locationResource) - if err != nil { - return err + // Proceed with registering manifests + if err := ucpclient.RegisterManifests(ctx, r.ResourceProviderManifestFilePath); err != nil { + return nil } - response, err := client.GetResourceProvider(ctx, "local", r.ResourceProvider.Name) + response, err := ucpclient.GetResourceProvider(ctx, "local", r.ResourceProvider.Name) if err != nil { return err } diff --git a/pkg/cli/cmd/utils.go b/pkg/cli/cmd/utils.go index e13b1243a2..58541acd4f 100644 --- a/pkg/cli/cmd/utils.go +++ b/pkg/cli/cmd/utils.go @@ -18,13 +18,16 @@ package cmd import ( "context" + "errors" "fmt" "github.com/radius-project/radius/pkg/cli/aws" "github.com/radius-project/radius/pkg/cli/azure" "github.com/radius-project/radius/pkg/cli/clients" "github.com/radius-project/radius/pkg/cli/clierrors" + "github.com/radius-project/radius/pkg/cli/workspaces" corerp "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" + "github.com/radius-project/radius/pkg/sdk" "github.com/radius-project/radius/pkg/to" ) @@ -94,3 +97,20 @@ func CheckIfRecipeExists(ctx context.Context, client clients.ApplicationsManagem return envResource, recipeProperties, nil } + +// GetConnection from Workspace. +func GetConnection(ctx context.Context, workspace *workspaces.Workspace) (sdk.Connection, error) { + connection, err := workspace.Connect() + if err != nil { + return nil, err + } + + err = sdk.TestConnection(ctx, connection) + if errors.Is(err, &sdk.ErrRadiusNotInstalled{}) { + return nil, clierrors.MessageWithCause(err, "Could not connect to Radius.") + } else if err != nil { + return nil, err + } + + return connection, nil +} diff --git a/pkg/ucp/api/v20231001preview/locations_fake_test.go b/pkg/ucp/api/v20231001preview/locations_fake_test.go deleted file mode 100644 index df5426505c..0000000000 --- a/pkg/ucp/api/v20231001preview/locations_fake_test.go +++ /dev/null @@ -1,149 +0,0 @@ -package v20231001preview_test - -import ( - "context" - "net/http" - "testing" - - armpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/stretchr/testify/require" - - v20231001preview "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/api/v20231001preview/fake" -) - -func TestLocationsServer(t *testing.T) { - // Initialize the fake LocationsServer with method implementations. - srv := &fake.LocationsServer{ - BeginCreateOrUpdate: func( - ctx context.Context, - planeName string, - resourceProviderName string, - locationName string, - resource v20231001preview.LocationResource, - options *v20231001preview.LocationsClientBeginCreateOrUpdateOptions, - ) (resp azfake.PollerResponder[v20231001preview.LocationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) { - // Create the response object. - result := v20231001preview.LocationsClientCreateOrUpdateResponse{ - LocationResource: resource, - } - - // Create a PollerResponder to simulate a long-running operation (LRO). - resp.AddNonTerminalResponse(http.StatusCreated, nil) - resp.SetTerminalResponse(http.StatusOK, result, nil) - - return - }, - Get: func( - ctx context.Context, - planeName string, - resourceProviderName string, - locationName string, - options *v20231001preview.LocationsClientGetOptions, - ) (resp azfake.Responder[v20231001preview.LocationsClientGetResponse], errResp azfake.ErrorResponder) { - response := v20231001preview.LocationsClientGetResponse{ - LocationResource: v20231001preview.LocationResource{ - Name: to.Ptr(locationName), - }, - } - resp.SetResponse(http.StatusOK, response, nil) - return - }, - BeginDelete: func( - ctx context.Context, - planeName string, - resourceProviderName string, - locationName string, - options *v20231001preview.LocationsClientBeginDeleteOptions, - ) (resp azfake.PollerResponder[v20231001preview.LocationsClientDeleteResponse], errResp azfake.ErrorResponder) { - // Create the response object. - result := v20231001preview.LocationsClientDeleteResponse{} - - resp.AddNonTerminalResponse(http.StatusNoContent, nil) - resp.SetTerminalResponse(http.StatusOK, result, nil) - return - }, - NewListPager: func( - planeName string, - resourceProviderName string, - options *v20231001preview.LocationsClientListOptions, - ) (resp azfake.PagerResponder[v20231001preview.LocationsClientListResponse]) { - // Simulate paging with two pages of results. - page1 := v20231001preview.LocationsClientListResponse{ - LocationResourceListResult: v20231001preview.LocationResourceListResult{ - Value: []*v20231001preview.LocationResource{ - {Name: to.Ptr("location1")}, - {Name: to.Ptr("location2")}, - }, - NextLink: to.Ptr("nextPageLink"), - }, - } - page2 := v20231001preview.LocationsClientListResponse{ - LocationResourceListResult: v20231001preview.LocationResourceListResult{ - Value: []*v20231001preview.LocationResource{ - {Name: to.Ptr("location3")}, - }, - }, - } - resp.AddPage(http.StatusOK, page1, nil) - resp.AddPage(http.StatusOK, page2, nil) - return - }, - } - - // Create a fake transport using the LocationsServer. - transport := fake.NewLocationsServerTransport(srv) - - // Set up client options with the fake transport. - clientOptions := &armpolicy.ClientOptions{ - ClientOptions: policy.ClientOptions{ - Transport: transport, - }, - } - - // Create the LocationsClient with the fake transport and mock credential. - client, err := v20231001preview.NewLocationsClient(&azfake.TokenCredential{}, clientOptions) - require.NoError(t, err) - - ctx := context.Background() - planeName := "testPlane" - resourceProviderName := "testResourceProvider" - locationName := "testLocation" - resource := v20231001preview.LocationResource{ - Name: to.Ptr(locationName), - } - - // Call BeginCreateOrUpdate and poll until completion. - pollerResp, err := client.BeginCreateOrUpdate(ctx, planeName, resourceProviderName, locationName, resource, nil) - require.NoError(t, err) - finalResp, err := pollerResp.PollUntilDone(ctx, nil) - require.NoError(t, err) - require.Equal(t, locationName, *finalResp.Name) - - // Call Get. - getResp, err := client.Get(ctx, planeName, resourceProviderName, locationName, nil) - require.NoError(t, err) - require.Equal(t, locationName, *getResp.Name) - - // Call BeginDelete and poll until completion. - deletePollerResp, err := client.BeginDelete(ctx, planeName, resourceProviderName, locationName, nil) - require.NoError(t, err) - _, err = deletePollerResp.PollUntilDone(ctx, nil) - require.NoError(t, err) - - // Call NewListPager. - pager := client.NewListPager(planeName, resourceProviderName, nil) - var locations []*v20231001preview.LocationResource - for pager.More() { - page, err := pager.NextPage(ctx) - require.NoError(t, err) - locations = append(locations, page.Value...) - } - require.Len(t, locations, 3) - require.Equal(t, "location1", *locations[0].Name) - require.Equal(t, "location2", *locations[1].Name) - require.Equal(t, "location3", *locations[2].Name) -} diff --git a/pkg/ucp/api/v20231001preview/resourceproviders_fakes_test.go b/pkg/ucp/api/v20231001preview/resourceproviders_fakes_test.go deleted file mode 100644 index 3cc5f0d063..0000000000 --- a/pkg/ucp/api/v20231001preview/resourceproviders_fakes_test.go +++ /dev/null @@ -1,159 +0,0 @@ -package v20231001preview_test - -import ( - "context" - "net/http" - "testing" - - armpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/stretchr/testify/require" - - v20231001preview "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/api/v20231001preview/fake" -) - -func TestResourceProvidersServer(t *testing.T) { - // Initialize the fake ResourceProvidersServer with method implementations. - srv := &fake.ResourceProvidersServer{ - BeginCreateOrUpdate: func( - ctx context.Context, - planeName string, - resourceProviderName string, - resource v20231001preview.ResourceProviderResource, - options *v20231001preview.ResourceProvidersClientBeginCreateOrUpdateOptions, - ) (resp azfake.PollerResponder[v20231001preview.ResourceProvidersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) { - result := v20231001preview.ResourceProvidersClientCreateOrUpdateResponse{ - ResourceProviderResource: resource, - } - - // resp.AddNonTerminalResponse(http.StatusCreated, nil) - resp.SetTerminalResponse(http.StatusOK, result, nil) - - return - }, - Get: func( - ctx context.Context, - planeName string, - resourceProviderName string, - options *v20231001preview.ResourceProvidersClientGetOptions, - ) (resp azfake.Responder[v20231001preview.ResourceProvidersClientGetResponse], errResp azfake.ErrorResponder) { - response := v20231001preview.ResourceProvidersClientGetResponse{ - ResourceProviderResource: v20231001preview.ResourceProviderResource{ - Name: to.Ptr(resourceProviderName), - }, - } - resp.SetResponse(http.StatusOK, response, nil) - return - }, - BeginDelete: func( - ctx context.Context, - planeName string, - resourceProviderName string, - options *v20231001preview.ResourceProvidersClientBeginDeleteOptions, - ) (resp azfake.PollerResponder[v20231001preview.ResourceProvidersClientDeleteResponse], errResp azfake.ErrorResponder) { - // Simulate a delete operation with a final response. - result := v20231001preview.ResourceProvidersClientDeleteResponse{} - - // resp.AddNonTerminalResponse(http.StatusCreated, nil) - resp.SetTerminalResponse(http.StatusOK, result, nil) - return - }, - // Updated NewListPager method - NewListPager: func( - planeName string, - options *v20231001preview.ResourceProvidersClientListOptions, - ) (resp azfake.PagerResponder[v20231001preview.ResourceProvidersClientListResponse]) { - // Simulate paging with two pages of results. - page1 := v20231001preview.ResourceProvidersClientListResponse{ - ResourceProviderResourceListResult: v20231001preview.ResourceProviderResourceListResult{ - Value: []*v20231001preview.ResourceProviderResource{ - {Name: to.Ptr("resourceProvider1")}, - {Name: to.Ptr("resourceProvider2")}, - }, - NextLink: to.Ptr("nextPageLink"), - }, - } - page2 := v20231001preview.ResourceProvidersClientListResponse{ - ResourceProviderResourceListResult: v20231001preview.ResourceProviderResourceListResult{ - Value: []*v20231001preview.ResourceProviderResource{ - {Name: to.Ptr("resourceProvider3")}, - }, - }, - } - resp.AddPage(http.StatusOK, page1, nil) - resp.AddPage(http.StatusOK, page2, nil) - return - }, - GetProviderSummary: func( - ctx context.Context, - planeName string, - resourceProviderName string, - options *v20231001preview.ResourceProvidersClientGetProviderSummaryOptions, - ) (resp azfake.Responder[v20231001preview.ResourceProvidersClientGetProviderSummaryResponse], errResp azfake.ErrorResponder) { - response := v20231001preview.ResourceProvidersClientGetProviderSummaryResponse{ - ResourceProviderSummary: v20231001preview.ResourceProviderSummary{ - Name: to.Ptr(resourceProviderName), - }, - } - resp.SetResponse(http.StatusOK, response, nil) - return - }, - } - - // Create a fake transport using the ResourceProvidersServer. - transport := fake.NewResourceProvidersServerTransport(srv) - clientOptions := &armpolicy.ClientOptions{ClientOptions: policy.ClientOptions{ - Transport: transport, - }} - - // Create the ResourceProvidersClient with the fake transport. - client, err := v20231001preview.NewResourceProvidersClient(&azfake.TokenCredential{}, clientOptions) - require.NoError(t, err) - - ctx := context.Background() - planeName := "local" - resourceProviderName := "testResourceProvider" - resource := v20231001preview.ResourceProviderResource{ - Name: to.Ptr(resourceProviderName), - } - - // Call BeginCreateOrUpdate and poll until completion. - pollerResp, err := client.BeginCreateOrUpdate(ctx, planeName, resourceProviderName, resource, nil) - require.NoError(t, err) - _, err = pollerResp.PollUntilDone(ctx, nil) - require.NoError(t, err) - - // Call Get. - getResp, err := client.Get(ctx, planeName, resourceProviderName, nil) - require.NoError(t, err) - require.Equal(t, resourceProviderName, *getResp.Name) - - // Call BeginDelete and poll until completion. - deletePollerResp, err := client.BeginDelete(ctx, planeName, resourceProviderName, nil) - require.NoError(t, err) - _, err = deletePollerResp.PollUntilDone(ctx, nil) - require.NoError(t, err) - - // Call NewListPager. - pager := client.NewListPager(planeName, nil) - var resources []*v20231001preview.ResourceProviderResource - - for pager.More() { - page, err := pager.NextPage(ctx) - require.NoError(t, err) - resources = append(resources, page.Value...) - } - - require.Len(t, resources, 3) - require.Equal(t, "resourceProvider1", *resources[0].Name) - require.Equal(t, "resourceProvider2", *resources[1].Name) - require.Equal(t, "resourceProvider3", *resources[2].Name) - - // Call GetProviderSummary. - summaryResp, err := client.GetProviderSummary(ctx, planeName, resourceProviderName, nil) - require.NoError(t, err) - require.Equal(t, resourceProviderName, *summaryResp.Name) -} diff --git a/pkg/ucp/api/v20231001preview/resourcetypes_fake_test.go b/pkg/ucp/api/v20231001preview/resourcetypes_fake_test.go deleted file mode 100644 index ff69d41eae..0000000000 --- a/pkg/ucp/api/v20231001preview/resourcetypes_fake_test.go +++ /dev/null @@ -1,148 +0,0 @@ -package v20231001preview_test - -import ( - "context" - "net/http" - "testing" - - armpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/stretchr/testify/require" - - v20231001preview "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" - "github.com/radius-project/radius/pkg/ucp/api/v20231001preview/fake" -) - -func TestResourceTypesServer(t *testing.T) { - // Initialize the fake ResourceTypesServer with method implementations. - srv := &fake.ResourceTypesServer{ - BeginCreateOrUpdate: func( - ctx context.Context, - planeName string, - resourceProviderName string, - resourceTypeName string, - resource v20231001preview.ResourceTypeResource, - options *v20231001preview.ResourceTypesClientBeginCreateOrUpdateOptions, - ) (resp azfake.PollerResponder[v20231001preview.ResourceTypesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) { - result := v20231001preview.ResourceTypesClientCreateOrUpdateResponse{ - ResourceTypeResource: resource, - } - - // Create a PollerResponder to simulate a long-running operation (LRO) - resp.SetTerminalResponse(http.StatusOK, result, nil) - - return - }, - Get: func( - ctx context.Context, - planeName string, - resourceProviderName string, - resourceTypeName string, - options *v20231001preview.ResourceTypesClientGetOptions, - ) (resp azfake.Responder[v20231001preview.ResourceTypesClientGetResponse], errResp azfake.ErrorResponder) { - response := v20231001preview.ResourceTypesClientGetResponse{ - ResourceTypeResource: v20231001preview.ResourceTypeResource{ - Name: to.Ptr(resourceTypeName), - }, - } - resp.SetResponse(http.StatusOK, response, nil) - return - }, - BeginDelete: func( - ctx context.Context, - planeName string, - resourceProviderName string, - resourceTypeName string, - options *v20231001preview.ResourceTypesClientBeginDeleteOptions, - ) (resp azfake.PollerResponder[v20231001preview.ResourceTypesClientDeleteResponse], errResp azfake.ErrorResponder) { - // Create the response object - result := v20231001preview.ResourceTypesClientDeleteResponse{} - // Create a PollerResponder to simulate a long-running operation (LRO) - resp.AddNonTerminalResponse(http.StatusAccepted, nil) - resp.SetTerminalResponse(http.StatusNoContent, result, nil) - - return - }, - NewListPager: func( - planeName string, - resourceProviderName string, - options *v20231001preview.ResourceTypesClientListOptions, - ) (resp azfake.PagerResponder[v20231001preview.ResourceTypesClientListResponse]) { - // Simulate paging with two pages of results. - page1 := v20231001preview.ResourceTypesClientListResponse{ - ResourceTypeResourceListResult: v20231001preview.ResourceTypeResourceListResult{ - Value: []*v20231001preview.ResourceTypeResource{ - {Name: to.Ptr("resourceType1")}, - {Name: to.Ptr("resourceType2")}, - }, - NextLink: to.Ptr("nextPageLink"), - }, - } - page2 := v20231001preview.ResourceTypesClientListResponse{ - ResourceTypeResourceListResult: v20231001preview.ResourceTypeResourceListResult{ - Value: []*v20231001preview.ResourceTypeResource{ - {Name: to.Ptr("resourceType3")}, - }, - }, - } - resp.AddPage(http.StatusOK, page1, nil) - resp.AddPage(http.StatusOK, page2, nil) - return - }, - } - - // Create a fake transport using the ResourceTypesServer. - transport := fake.NewResourceTypesServerTransport(srv) - - // Set up client options with the fake transport. - clientOptions := &armpolicy.ClientOptions{ - ClientOptions: policy.ClientOptions{ - Transport: transport, - }, - } - - // Create the ResourceTypesClient with the fake transport and mock credential. - client, err := v20231001preview.NewResourceTypesClient(&azfake.TokenCredential{}, clientOptions) - require.NoError(t, err) - - ctx := context.Background() - planeName := "local" - resourceProviderName := "testResourceProvider" - resourceTypeName := "testResourceType" - resource := v20231001preview.ResourceTypeResource{ - Name: to.Ptr(resourceTypeName), - } - - // Call BeginCreateOrUpdate and poll until completion. - pollerResp, err := client.BeginCreateOrUpdate(ctx, planeName, resourceProviderName, resourceTypeName, resource, nil) - require.NoError(t, err) - finalResp, err := pollerResp.PollUntilDone(ctx, nil) - require.NoError(t, err) - require.Equal(t, resourceTypeName, *finalResp.Name) - - // Call Get. - getResp, err := client.Get(ctx, planeName, resourceProviderName, resourceTypeName, nil) - require.NoError(t, err) - require.Equal(t, resourceTypeName, *getResp.Name) - - // Call BeginDelete and poll until completion. - deletePollerResp, err := client.BeginDelete(ctx, planeName, resourceProviderName, resourceTypeName, nil) - require.NoError(t, err) - _, err = deletePollerResp.PollUntilDone(ctx, nil) - require.NoError(t, err) - - // Call NewListPager. - pager := client.NewListPager(planeName, resourceProviderName, nil) - var resources []*v20231001preview.ResourceTypeResource - for pager.More() { - page, err := pager.NextPage(ctx) - require.NoError(t, err) - resources = append(resources, page.Value...) - } - require.Len(t, resources, 3) - require.Equal(t, "resourceType1", *resources[0].Name) - require.Equal(t, "resourceType2", *resources[1].Name) - require.Equal(t, "resourceType3", *resources[2].Name) -} diff --git a/pkg/ucp/ucpclient/registermanifests.go b/pkg/ucp/ucpclient/registermanifests.go index e86f60fefe..cc0b447fe5 100644 --- a/pkg/ucp/ucpclient/registermanifests.go +++ b/pkg/ucp/ucpclient/registermanifests.go @@ -83,9 +83,10 @@ func (u *UCPClient) RegisterManifests(ctx context.Context, manifestDirectory str // Iterate over each file in the directory for _, fileInfo := range files { if fileInfo.IsDir() { - continue // Skip directories - check if want to include subdirectories + continue // Skip directories - TBD: check if want to include subdirectories } filePath := filepath.Join(manifestDirectory, fileInfo.Name()) + // Read the manifest file resourceProvider, err := manifest.ReadFile(filePath) if err != nil {