Skip to content

Commit 3343152

Browse files
committed
trying to fix the weird test
1 parent 1853330 commit 3343152

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

cluster-autoscaler/cloudprovider/oci/nodepools/oci_manager.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,7 @@ func (m *ociManagerImpl) forceRefresh() error {
449449
}
450450

451451
m.lastRefresh = time.Now()
452-
if m.cfg == nil {
453-
klog.Errorf("manager config is nil")
454-
} else {
455-
klog.Infof("Refreshed NodePool list, next refresh after %v", m.lastRefresh.Add(m.cfg.Global.RefreshInterval))
456-
}
452+
klog.Infof("Refreshed NodePool list, next refresh after %v", m.lastRefresh.Add(m.cfg.Global.RefreshInterval))
457453
return nil
458454
}
459455

cluster-autoscaler/cloudprovider/oci/nodepools/oci_manager_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import (
1111
"net/http"
1212
"reflect"
1313
"testing"
14+
"time"
1415

1516
apiv1 "k8s.io/api/core/v1"
1617
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
1718
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/vendor-internal/github.com/oracle/oci-go-sdk/v65/common"
1819
kubeletapis "k8s.io/kubelet/pkg/apis"
1920

2021
ocicommon "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/common"
21-
npconsts "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/nodepools/consts"
2222
oke "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/vendor-internal/github.com/oracle/oci-go-sdk/v65/containerengine"
2323
)
2424

@@ -447,11 +447,10 @@ func TestNodeGroupAutoDiscovery(t *testing.T) {
447447
nodePoolCache := newNodePoolCache(nil)
448448
nodePoolCache.okeClient = mockOKEClient{}
449449

450-
cloudConfig, err := ocicommon.CreateCloudConfig("", common.DefaultConfigProvider(), npconsts.OciNodePoolResourceIdent)
451-
if cloudConfig == nil || err != nil {
452-
//klog.Infof("Error: cloudConfig is nil. %s", err)
453-
t.Errorf("Error: cloudConfig is nil. %s", err)
454-
}
450+
cloudConfig := &ocicommon.CloudConfig{}
451+
cloudConfig.Global.RefreshInterval = 5 * time.Minute
452+
cloudConfig.Global.CompartmentID = autoDiscoveryCompartment
453+
455454
manager := &ociManagerImpl{
456455
nodePoolCache: nodePoolCache,
457456
nodeGroups: []nodeGroupAutoDiscovery{*nodeGroup},

0 commit comments

Comments
 (0)