From 5e013d0d327dee9f5cd53fee6ec8d2d2593e0258 Mon Sep 17 00:00:00 2001 From: "Igor D.C" Date: Thu, 8 Oct 2020 18:44:14 +0000 Subject: Restore commented unit test TestDeleteLogicalCloud Restore the previously commented-out unit test TestDeleteLogicalCloud. That test was disabled due to a failure introduced by interacting with AppContext for the first time in module/logicalcloud.go and it not being ready to do so. This commit restores it and modifies code so dependent mocks can plug in correctly. This was done in order to keep testing the code that was previously being tested, not so much to add additional coverage. Although it would be a significant undertaking, the different types and interfaces in pkg/module should be redesigned to achieve better decoupling and thus make unit testing more straightforward. Issue-ID: MULTICLOUD-1143 Change-Id: I1e6b7bb9111fc6883f0c9cee887329a9e0b27fbd Signed-off-by: Igor D.C --- src/dcm/pkg/module/cluster.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/dcm/pkg/module/cluster.go') diff --git a/src/dcm/pkg/module/cluster.go b/src/dcm/pkg/module/cluster.go index 9aecc6ca..6ad46404 100644 --- a/src/dcm/pkg/module/cluster.go +++ b/src/dcm/pkg/module/cluster.go @@ -260,7 +260,11 @@ func (v *ClusterClient) UpdateCluster(project, logicalCloud, clusterReference st // Get returns Cluster's kubeconfig for corresponding cluster reference func (v *ClusterClient) GetClusterConfig(project, logicalCloud, clusterReference string) (string, error) { lcClient := NewLogicalCloudClient() - context, ctxVal, err := lcClient.GetLogicalCloudContext(project, logicalCloud) + lckey := LogicalCloudKey{ + Project: project, + LogicalCloudName: logicalCloud, + } + context, ctxVal, err := lcClient.util.GetLogicalCloudContext(lcClient.storeName, lckey, lcClient.tagMeta, project, logicalCloud) if err != nil { return "", pkgerrors.Wrap(err, "Error getting logical cloud context.") } @@ -268,11 +272,6 @@ func (v *ClusterClient) GetClusterConfig(project, logicalCloud, clusterReference return "", pkgerrors.New("Logical Cloud hasn't been applied yet") } - // private key comes from logical cloud - lckey := LogicalCloudKey{ - Project: project, - LogicalCloudName: logicalCloud, - } // get logical cloud resource lc, err := lcClient.Get(project, logicalCloud) if err != nil { -- cgit 1.2.3-korg