refactor(coderd/database): split Time and Now into dbtime package (#9482)

Ref: #9380
This commit is contained in:
Mathias Fredriksson
2023-09-01 19:50:12 +03:00
committed by GitHub
parent 702b064cac
commit 19d7da3d24
89 changed files with 466 additions and 390 deletions

View File

@ -23,6 +23,7 @@ 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/dbtime"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
"github.com/coder/coder/v2/provisioner/echo"
@ -307,11 +308,11 @@ func TestWorkspaceAgentStartupLogs(t *testing.T) {
err := agentClient.PatchLogs(ctx, agentsdk.PatchLogs{
Logs: []agentsdk.Log{
{
CreatedAt: database.Now(),
CreatedAt: dbtime.Now(),
Output: "testing",
},
{
CreatedAt: database.Now(),
CreatedAt: dbtime.Now(),
Output: "testing2",
},
},
@ -371,7 +372,7 @@ func TestWorkspaceAgentStartupLogs(t *testing.T) {
err := agentClient.PatchLogs(ctx, agentsdk.PatchLogs{
Logs: []agentsdk.Log{
{
CreatedAt: database.Now(),
CreatedAt: dbtime.Now(),
Output: "testing",
},
},
@ -405,7 +406,7 @@ func TestWorkspaceAgentStartupLogs(t *testing.T) {
err = agentClient.PatchLogs(ctx, agentsdk.PatchLogs{
Logs: []agentsdk.Log{
{
CreatedAt: database.Now(),
CreatedAt: dbtime.Now(),
Output: "testing2",
},
},
@ -458,7 +459,7 @@ func TestWorkspaceAgentStartupLogs(t *testing.T) {
agentClient.SetSessionToken(authToken)
err = agentClient.PatchLogs(ctx, agentsdk.PatchLogs{
Logs: []agentsdk.Log{{
CreatedAt: database.Now(),
CreatedAt: dbtime.Now(),
Output: strings.Repeat("a", (1<<20)+1),
}},
})