From c5ce197c3073a7ae28e9bcf4a6e1cc6bcad7d9c5 Mon Sep 17 00:00:00 2001 From: Chunyi Lyu Date: Tue, 7 Jan 2025 15:25:25 +0000 Subject: [PATCH] chore: update healthRecord lastRun type to int64 - from string --- api/v1alpha1/healthrecord_types.go | 2 +- config/crd/bases/platform.kratix.io_healthrecords.yaml | 3 ++- controllers/healthrecord_controller_test.go | 3 +-- test/system/healthchecks_test.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/v1alpha1/healthrecord_types.go b/api/v1alpha1/healthrecord_types.go index e0358cab..1178f864 100644 --- a/api/v1alpha1/healthrecord_types.go +++ b/api/v1alpha1/healthrecord_types.go @@ -46,7 +46,7 @@ type HealthRecordData struct { State string `json:"state"` // Timestamp of the last healthcheck run - LastRun string `json:"lastRun,omitempty"` + LastRun int64 `json:"lastRun,omitempty"` // +kubebuilder:pruning:PreserveUnknownFields // +kubebuilder:validation:Optional diff --git a/config/crd/bases/platform.kratix.io_healthrecords.yaml b/config/crd/bases/platform.kratix.io_healthrecords.yaml index 236e51bb..46cbf39b 100644 --- a/config/crd/bases/platform.kratix.io_healthrecords.yaml +++ b/config/crd/bases/platform.kratix.io_healthrecords.yaml @@ -34,7 +34,8 @@ spec: x-kubernetes-preserve-unknown-fields: true lastRun: description: Timestamp of the last healthcheck run - type: string + format: int64 + type: integer promiseRef: properties: name: diff --git a/controllers/healthrecord_controller_test.go b/controllers/healthrecord_controller_test.go index e926a21b..37bb7140 100644 --- a/controllers/healthrecord_controller_test.go +++ b/controllers/healthrecord_controller_test.go @@ -1,7 +1,6 @@ package controllers_test import ( - "fmt" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/runtime" @@ -55,7 +54,7 @@ var _ = Describe("HealthRecordController", func() { PromiseRef: v1alpha1.PromiseRef{Name: promise.GetName()}, ResourceRef: v1alpha1.ResourceRef{Name: resource.GetName(), Namespace: resource.GetNamespace()}, State: "healthy", - LastRun: fmt.Sprintf("%d", time.Now().Unix()), + LastRun: time.Now().Unix(), Details: details, }, } diff --git a/test/system/healthchecks_test.go b/test/system/healthchecks_test.go index 7dc0bf9f..3e796372 100644 --- a/test/system/healthchecks_test.go +++ b/test/system/healthchecks_test.go @@ -118,7 +118,7 @@ var _ = Describe("Kratix Healthcheck", func() { PromiseRef: v1alpha1.PromiseRef{Name: bashPromiseName}, ResourceRef: v1alpha1.ResourceRef{Name: rrName, Namespace: "default", Generation: 1}, State: "healthy", - LastRun: fmt.Sprintf("%d", time.Now().Unix()), + LastRun: time.Now().Unix(), Details: &runtime.RawExtension{ Raw: []byte(`{"info":"message", "errors": [{"message": "error"}]}`), },