From 394caa0138613e70af7acdf27971745bfcc515cf Mon Sep 17 00:00:00 2001 From: Victor Lyuboslavsky Date: Fri, 13 Sep 2024 16:29:51 -0500 Subject: [PATCH] Fixed created_at timestamp for install results. (#22093) Unreleased bug #22091 # Checklist for submitter - [x] Added/updated tests - [x] Manual QA for all new/changed functionality --- server/datastore/mysql/software_installers.go | 1 + server/service/integration_enterprise_test.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/server/datastore/mysql/software_installers.go b/server/datastore/mysql/software_installers.go index 5a7273a74c..23a0a1e456 100644 --- a/server/datastore/mysql/software_installers.go +++ b/server/datastore/mysql/software_installers.go @@ -438,6 +438,7 @@ SELECT hsi.install_script_exit_code, hsi.self_service, hsi.host_deleted_at, + hsi.created_at as created_at, si.user_id AS software_installer_user_id, si.user_name AS software_installer_user_name, si.user_email AS software_installer_user_email diff --git a/server/service/integration_enterprise_test.go b/server/service/integration_enterprise_test.go index 9e1cf62a04..e5d9316ae4 100644 --- a/server/service/integration_enterprise_test.go +++ b/server/service/integration_enterprise_test.go @@ -11757,6 +11757,7 @@ func (s *integrationEnterpriseTestSuite) TestHostSoftwareInstallResult() { } // create some install requests for the host + beforeInstall := time.Now() installUUIDs := make([]string, 3) titleIDs := []uint{titleID, titleID2, titleID3} for i := 0; i < len(installUUIDs); i++ { @@ -11783,6 +11784,8 @@ func (s *integrationEnterpriseTestSuite) TestHostSoftwareInstallResult() { assert.Equal(t, want.PreInstallQueryOutput, resp.Results.PreInstallQueryOutput) assert.Equal(t, want.Output, resp.Results.Output) assert.Equal(t, want.PostInstallScriptOutput, resp.Results.PostInstallScriptOutput) + assert.Less(t, beforeInstall, resp.Results.CreatedAt) + assert.Greater(t, time.Now(), resp.Results.CreatedAt) } s.Do("POST", "/api/fleet/orbit/software_install/result",