From c0e4043f03d53a0ee8df50f57cfe6d34d01acd1e Mon Sep 17 00:00:00 2001 From: Bryce Soghigian <49734722+Bryce-Soghigian@users.noreply.github.com> Date: Tue, 28 Jan 2025 02:32:16 +0000 Subject: [PATCH] fix: modifying the tests to be aware of time created to properly simulate vm gc --- pkg/controllers/nodeclaim/garbagecollection/suite_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/controllers/nodeclaim/garbagecollection/suite_test.go b/pkg/controllers/nodeclaim/garbagecollection/suite_test.go index e88becb21..2aed1af8b 100644 --- a/pkg/controllers/nodeclaim/garbagecollection/suite_test.go +++ b/pkg/controllers/nodeclaim/garbagecollection/suite_test.go @@ -405,6 +405,9 @@ var _ = Describe("NetworkInterface Garbage Collection", func() { managedVM := test.VirtualMachine(test.VirtualMachineOptions{ Name: lo.FromPtr(managedNic.Name), Tags: test.ManagedTags(nodePool.Name), + Properties: &armcompute.VirtualMachineProperties{ + TimeCreated: lo.ToPtr(time.Now().Add(-time.Minute * 16)), // Needs to be older than the nodeclaim registration ttl + }, }) azureEnv.VirtualMachinesAPI.VirtualMachinesBehavior.Instances.Store(lo.FromPtr(managedVM.ID), *managedVM) ExpectSingletonReconciled(ctx, networkInterfaceGCController)