From 15025ef970db52e51966e8224f556da34af6d764 Mon Sep 17 00:00:00 2001 From: willie-yao Date: Mon, 4 Mar 2024 17:28:41 +0000 Subject: [PATCH] Fix unit tests --- azure/services/agentpools/agentpools_test.go | 2 ++ controllers/azuremanagedmachinepool_controller_test.go | 1 + 2 files changed, 3 insertions(+) diff --git a/azure/services/agentpools/agentpools_test.go b/azure/services/agentpools/agentpools_test.go index 6b57723002a3..fed96ccd17f8 100644 --- a/azure/services/agentpools/agentpools_test.go +++ b/azure/services/agentpools/agentpools_test.go @@ -46,6 +46,7 @@ func TestPostCreateOrUpdateResourceHook(t *testing.T) { scope := mock_agentpools.NewMockAgentPoolScope(mockCtrl) scope.EXPECT().RemoveCAPIMachinePoolAnnotation(clusterv1.ReplicasManagedByAnnotation) + scope.EXPECT().IsPreviewEnabled().Return(false) managedCluster := &asocontainerservicev1.ManagedClustersAgentPool{ Status: asocontainerservicev1.ManagedClusters_AgentPool_STATUS{ @@ -64,6 +65,7 @@ func TestPostCreateOrUpdateResourceHook(t *testing.T) { scope.EXPECT().SetCAPIMachinePoolAnnotation(clusterv1.ReplicasManagedByAnnotation, "true") scope.EXPECT().SetCAPIMachinePoolReplicas(ptr.To(1234)) + scope.EXPECT().IsPreviewEnabled().Return(false) managedCluster := &asocontainerservicev1.ManagedClustersAgentPool{ Status: asocontainerservicev1.ManagedClusters_AgentPool_STATUS{ diff --git a/controllers/azuremanagedmachinepool_controller_test.go b/controllers/azuremanagedmachinepool_controller_test.go index 95ce11a13ef4..5f1c6d48055e 100644 --- a/controllers/azuremanagedmachinepool_controller_test.go +++ b/controllers/azuremanagedmachinepool_controller_test.go @@ -72,6 +72,7 @@ func TestAzureManagedMachinePoolReconcile(t *testing.T) { agentpools.SetAgentPoolProviderIDList(providerIDs) agentpools.SetAgentPoolReplicas(int32(len(providerIDs))).Return() agentpools.SetAgentPoolReady(true).Return() + agentpools.IsPreviewEnabled().Return(false) nodelister.List(gomock2.AContext(), "fake-rg").Return(fakeVirtualMachineScaleSet, nil) nodelister.ListInstances(gomock2.AContext(), "fake-rg", "vmssName").Return(fakeVirtualMachineScaleSetVM, nil)