From 4f4329dd5cc52c8919fd2639353f3e6136f0b1e4 Mon Sep 17 00:00:00 2001 From: Balazs Nadasdi Date: Fri, 8 Oct 2021 16:06:28 +0200 Subject: [PATCH] (time.Time).UnixMilli was added in go1.17 --- core/application/app_test.go | 8 ++++---- core/application/commands.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/application/app_test.go b/core/application/app_test.go index 802f55ae1..a4ac7fdb9 100644 --- a/core/application/app_test.go +++ b/core/application/app_test.go @@ -49,7 +49,7 @@ func TestApp_CreateMicroVM(t *testing.T) { ) expectedCreatedSpec := createTestSpec("id1234", defaults.MicroVMNamespace) - expectedCreatedSpec.Spec.CreatedAt = frozenTime().UnixMilli() + expectedCreatedSpec.Spec.CreatedAt = frozenTime().Unix() rm.Save( gomock.AssignableToTypeOf(context.Background()), @@ -84,7 +84,7 @@ func TestApp_CreateMicroVM(t *testing.T) { ) expectedCreatedSpec := createTestSpec("id1234", "default") - expectedCreatedSpec.Spec.CreatedAt = frozenTime().UnixMilli() + expectedCreatedSpec.Spec.CreatedAt = frozenTime().Unix() rm.Save( gomock.AssignableToTypeOf(context.Background()), @@ -198,7 +198,7 @@ func TestApp_UpdateMicroVM(t *testing.T) { ) expectedUpdatedSpec := createTestSpec("id1234", "default") - expectedUpdatedSpec.Spec.UpdatedAt = frozenTime().UnixMilli() + expectedUpdatedSpec.Spec.UpdatedAt = frozenTime().Unix() rm.Save( gomock.AssignableToTypeOf(context.Background()), @@ -294,7 +294,7 @@ func TestApp_DeleteMicroVM(t *testing.T) { ) expectedUpdatedSpec := createTestSpec("id1234", "default") - expectedUpdatedSpec.Spec.DeletedAt = frozenTime().UnixMilli() + expectedUpdatedSpec.Spec.DeletedAt = frozenTime().Unix() rm.Save( gomock.AssignableToTypeOf(context.Background()), diff --git a/core/application/commands.go b/core/application/commands.go index 47841730e..3b201222e 100644 --- a/core/application/commands.go +++ b/core/application/commands.go @@ -47,7 +47,7 @@ func (a *app) CreateMicroVM(ctx context.Context, mvm *models.MicroVM) (*models.M // TODO: validate the spec // Set the timestamp when the VMspec was created. - mvm.Spec.CreatedAt = a.ports.Clock().UnixMilli() + mvm.Spec.CreatedAt = a.ports.Clock().Unix() createdMVM, err := a.ports.Repo.Save(ctx, mvm) if err != nil { @@ -90,7 +90,7 @@ func (a *app) UpdateMicroVM(ctx context.Context, mvm *models.MicroVM) (*models.M // TODO: check if update is valid (i.e. compare existing to requested update) // Set the timestamp when the VMspec was updated. - mvm.Spec.UpdatedAt = a.ports.Clock().UnixMilli() + mvm.Spec.UpdatedAt = a.ports.Clock().Unix() updatedMVM, err := a.ports.Repo.Save(ctx, mvm) if err != nil { @@ -127,7 +127,7 @@ func (a *app) DeleteMicroVM(ctx context.Context, id, namespace string) error { } // Set the timestamp when the VMspec was deleted. - foundMvm.Spec.DeletedAt = a.ports.Clock().UnixMilli() + foundMvm.Spec.DeletedAt = a.ports.Clock().Unix() _, err = a.ports.Repo.Save(ctx, foundMvm) if err != nil {