diff --git a/internal/controller/bmc_controller_test.go b/internal/controller/bmc_controller_test.go index 0b3c6e7..b1bcbb2 100644 --- a/internal/controller/bmc_controller_test.go +++ b/internal/controller/bmc_controller_test.go @@ -17,11 +17,9 @@ import ( var _ = Describe("BMC Controller", func() { _ = SetupTest() - var endpoint *metalv1alpha1.Endpoint - - BeforeEach(func(ctx SpecContext) { + It("Should successfully reconcile the a BMC resource", func(ctx SpecContext) { By("Creating an Endpoints object") - endpoint = &metalv1alpha1.Endpoint{ + endpoint := &metalv1alpha1.Endpoint{ ObjectMeta: metav1.ObjectMeta{ GenerateName: "test-", }, @@ -57,15 +55,8 @@ var _ = Describe("BMC Controller", func() { }, } DeferCleanup(k8sClient.Delete, server) - }) - It("Should successfully reconcile the a BMC resource", func(ctx SpecContext) { By("Ensuring that the BMC resource has been created for an endpoint") - bmc := &metalv1alpha1.BMC{ - ObjectMeta: metav1.ObjectMeta{ - Name: endpoint.Name, - }, - } Eventually(Object(bmc)).Should(SatisfyAll( HaveField("OwnerReferences", ContainElement(metav1.OwnerReference{ APIVersion: "metal.ironcore.dev/v1alpha1", @@ -84,11 +75,6 @@ var _ = Describe("BMC Controller", func() { )) By("Ensuring that the Server resource has been created") - server := &metalv1alpha1.Server{ - ObjectMeta: metav1.ObjectMeta{ - Name: GetServerNameFromBMCandIndex(0, bmc), - }, - } Eventually(Object(server)).Should(SatisfyAll( HaveField("OwnerReferences", ContainElement(metav1.OwnerReference{ APIVersion: "metal.ironcore.dev/v1alpha1", diff --git a/internal/controller/server_controller.go b/internal/controller/server_controller.go index 2c3b887..d608519 100644 --- a/internal/controller/server_controller.go +++ b/internal/controller/server_controller.go @@ -159,7 +159,7 @@ func (r *ServerReconciler) reconcile(ctx context.Context, log logr.Logger, serve if err := r.updateServerStatus(ctx, log, server); err != nil { return ctrl.Result{}, fmt.Errorf("failed to update server status: %w", err) } - log.V(1).Info("Updated Server status") + log.V(1).Info("Updated Server status", "Status", server.Status.State) if err := r.applyBiosSettings(ctx, log, server); err != nil { return ctrl.Result{}, fmt.Errorf("failed to update server bios settings: %w", err) diff --git a/internal/controller/server_controller_test.go b/internal/controller/server_controller_test.go index 74bc407..c09d6f8 100644 --- a/internal/controller/server_controller_test.go +++ b/internal/controller/server_controller_test.go @@ -25,12 +25,9 @@ import ( var _ = Describe("Server Controller", func() { ns := SetupTest() - var endpoint *metalv1alpha1.Endpoint - var bmc *metalv1alpha1.BMC - It("Should initialize a Server from Endpoint", func(ctx SpecContext) { By("Creating an Endpoint object") - endpoint = &metalv1alpha1.Endpoint{ + endpoint := &metalv1alpha1.Endpoint{ ObjectMeta: metav1.ObjectMeta{ GenerateName: "test-", }, @@ -44,7 +41,7 @@ var _ = Describe("Server Controller", func() { DeferCleanup(k8sClient.Delete, endpoint) By("Ensuring that the BMC resource has been created for an endpoint") - bmc = &metalv1alpha1.BMC{ + bmc := &metalv1alpha1.BMC{ ObjectMeta: metav1.ObjectMeta{ Name: endpoint.Name, }, @@ -273,12 +270,12 @@ var _ = Describe("Server Controller", func() { )) By("Ensuring that the server is set back to initial due to the discovery check timing out") - Eventually(Object(server), "1000ms").Should(SatisfyAll( + Eventually(Object(server)).Should(SatisfyAll( HaveField("Status.State", metalv1alpha1.ServerStateInitial), )) By("Starting the probe agent") - probeAgent := probe.NewAgent(server.Spec.UUID, registryURL, 100*time.Millisecond) + probeAgent := probe.NewAgent(server.Spec.UUID, registryURL, 50*time.Millisecond) go func() { defer GinkgoRecover() Expect(probeAgent.Start(ctx)).To(Succeed(), "failed to start probe agent") diff --git a/internal/controller/suite_test.go b/internal/controller/suite_test.go index dde67ba..1960bf2 100644 --- a/internal/controller/suite_test.go +++ b/internal/controller/suite_test.go @@ -180,7 +180,7 @@ func SetupTest() *corev1.Namespace { ProbeOSImage: "fooOS:latest", RegistryURL: registryURL, RegistryResyncInterval: 50 * time.Millisecond, - ResyncInterval: 100 * time.Millisecond, + ResyncInterval: 50 * time.Millisecond, EnforceFirstBoot: true, BMCOptions: bmc.BMCOptions{ PowerPollingInterval: 50 * time.Millisecond,