fix(coderd): emit CollectedAt as UTC in convertWorkspaceAgentMetadata (#9700)

This commit is contained in:
Cian Johnston 2023-09-18 09:17:18 +01:00 committed by GitHub
parent 5de5d20808
commit 653488e8ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 6 deletions

View File

@ -1808,7 +1808,7 @@ func convertWorkspaceAgentMetadata(db []database.WorkspaceAgentMetadatum) []code
Result: codersdk.WorkspaceAgentMetadataResult{
Value: datum.Value,
Error: datum.Error,
CollectedAt: datum.CollectedAt,
CollectedAt: datum.CollectedAt.UTC(),
Age: int64(time.Since(datum.CollectedAt).Seconds()),
},
Description: codersdk.WorkspaceAgentMetadataDescription{

View File

@ -23,7 +23,6 @@ import (
"github.com/coder/coder/v2/agent"
"github.com/coder/coder/v2/coderd/coderdtest"
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/database/dbtestutil"
"github.com/coder/coder/v2/coderd/database/dbtime"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
@ -1185,12 +1184,8 @@ func TestWorkspaceAgent_LifecycleState(t *testing.T) {
func TestWorkspaceAgent_Metadata(t *testing.T) {
t.Parallel()
// nolint:gocritic // https://github.com/coder/coder/issues/9682
db, ps := dbtestutil.NewDB(t, dbtestutil.WithTimezone("UTC"))
client := coderdtest.New(t, &coderdtest.Options{
IncludeProvisionerDaemon: true,
Database: db,
Pubsub: ps,
})
user := coderdtest.CreateFirstUser(t, client)
authToken := uuid.NewString()