Skip to content

Commit 863c3dc

Browse files
fix: fix broken tests and convert bug
1 parent b6289bb commit 863c3dc

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

agent/agent_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,10 +1517,12 @@ func TestAgent_Lifecycle(t *testing.T) {
15171517
agentsdk.Manifest{
15181518
DERPMap: derpMap,
15191519
Scripts: []codersdk.WorkspaceAgentScript{{
1520+
ID: uuid.New(),
15201521
LogPath: "coder-startup-script.log",
15211522
Script: "echo 1",
15221523
RunOnStart: true,
15231524
}, {
1525+
ID: uuid.New(),
15241526
LogPath: "coder-shutdown-script.log",
15251527
Script: "echo " + expected,
15261528
RunOnStop: true,

coderd/agentapi/manifest_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ func TestGetManifest(t *testing.T) {
108108
}
109109
scripts = []database.WorkspaceAgentScript{
110110
{
111+
ID: uuid.New(),
111112
WorkspaceAgentID: agent.ID,
112113
LogSourceID: uuid.New(),
113114
LogPath: "/cool/log/path/1",
@@ -119,6 +120,7 @@ func TestGetManifest(t *testing.T) {
119120
TimeoutSeconds: 60,
120121
},
121122
{
123+
ID: uuid.New(),
122124
WorkspaceAgentID: agent.ID,
123125
LogSourceID: uuid.New(),
124126
LogPath: "/cool/log/path/2",
@@ -227,6 +229,7 @@ func TestGetManifest(t *testing.T) {
227229
}
228230
protoScripts = []*agentproto.WorkspaceAgentScript{
229231
{
232+
Id: scripts[0].ID[:],
230233
LogSourceId: scripts[0].LogSourceID[:],
231234
LogPath: scripts[0].LogPath,
232235
Script: scripts[0].Script,
@@ -237,6 +240,7 @@ func TestGetManifest(t *testing.T) {
237240
Timeout: durationpb.New(time.Duration(scripts[0].TimeoutSeconds) * time.Second),
238241
},
239242
{
243+
Id: scripts[1].ID[:],
240244
LogSourceId: scripts[1].LogSourceID[:],
241245
LogPath: scripts[1].LogPath,
242246
Script: scripts[1].Script,

codersdk/agentsdk/convert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ func AgentScriptFromProto(protoScript *proto.WorkspaceAgentScript) (codersdk.Wor
184184

185185
func ProtoFromScript(s codersdk.WorkspaceAgentScript) *proto.WorkspaceAgentScript {
186186
return &proto.WorkspaceAgentScript{
187+
Id: s.ID[:],
187188
DisplayName: s.DisplayName,
188189
LogSourceId: s.LogSourceID[:],
189190
LogPath: s.LogPath,

codersdk/agentsdk/convert_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func TestManifest(t *testing.T) {
106106
},
107107
Scripts: []codersdk.WorkspaceAgentScript{
108108
{
109+
ID: uuid.New(),
109110
LogSourceID: uuid.New(),
110111
LogPath: "/var/log/script.log",
111112
Script: "script",
@@ -116,6 +117,7 @@ func TestManifest(t *testing.T) {
116117
Timeout: time.Second,
117118
},
118119
{
120+
ID: uuid.New(),
119121
LogSourceID: uuid.New(),
120122
LogPath: "/var/log/script2.log",
121123
Script: "script2",

0 commit comments

Comments
 (0)