@@ -147,7 +147,7 @@ type data struct {
147
147
workspaceAgentLogs []database.WorkspaceAgentLog
148
148
workspaceAgentLogSources []database.WorkspaceAgentLogSource
149
149
workspaceAgentScripts []database.WorkspaceAgentScript
150
- workspaceAgentPortShare []database.WorkspaceAgentPortShare
150
+ workspaceAgentPortShares []database.WorkspaceAgentPortShare
151
151
workspaceApps []database.WorkspaceApp
152
152
workspaceAppStatsLastInsertID int64
153
153
workspaceAppStats []database.WorkspaceAppStat
@@ -1012,14 +1012,14 @@ func (q *FakeQuerier) CreateWorkspaceAgentPortShare(_ context.Context, arg datab
1012
1012
q .mutex .Lock ()
1013
1013
defer q .mutex .Unlock ()
1014
1014
1015
- for _ , share := range q .workspaceAgentPortShare {
1015
+ for _ , share := range q .workspaceAgentPortShares {
1016
1016
if share .WorkspaceID == arg .WorkspaceID && share .AgentName == arg .AgentName && share .Port == arg .Port {
1017
1017
return xerrors .New ("port share already exists" )
1018
1018
}
1019
1019
}
1020
1020
1021
1021
//nolint:gosimple // I disagree
1022
- q .workspaceAgentPortShare = append (q .workspaceAgentPortShare , database.WorkspaceAgentPortShare {
1022
+ q .workspaceAgentPortShares = append (q .workspaceAgentPortShares , database.WorkspaceAgentPortShare {
1023
1023
WorkspaceID : arg .WorkspaceID ,
1024
1024
AgentName : arg .AgentName ,
1025
1025
Port : arg .Port ,
@@ -1353,9 +1353,9 @@ func (q *FakeQuerier) DeleteWorkspaceAgentPortShare(_ context.Context, arg datab
1353
1353
q .mutex .Lock ()
1354
1354
defer q .mutex .Unlock ()
1355
1355
1356
- for i , share := range q .workspaceAgentPortShare {
1356
+ for i , share := range q .workspaceAgentPortShares {
1357
1357
if share .WorkspaceID == arg .WorkspaceID && share .AgentName == arg .AgentName && share .Port == arg .Port {
1358
- q .workspaceAgentPortShare = append (q .workspaceAgentPortShare [:i ], q .workspaceAgentPortShare [i + 1 :]... )
1358
+ q .workspaceAgentPortShares = append (q .workspaceAgentPortShares [:i ], q .workspaceAgentPortShares [i + 1 :]... )
1359
1359
return nil
1360
1360
}
1361
1361
}
@@ -4209,7 +4209,7 @@ func (q *FakeQuerier) GetWorkspaceAgentPortShare(_ context.Context, arg database
4209
4209
q .mutex .RLock ()
4210
4210
defer q .mutex .RUnlock ()
4211
4211
4212
- for _ , share := range q .workspaceAgentPortShare {
4212
+ for _ , share := range q .workspaceAgentPortShares {
4213
4213
if share .WorkspaceID == arg .WorkspaceID && share .AgentName == arg .AgentName && share .Port == arg .Port {
4214
4214
return share , nil
4215
4215
}
@@ -7072,7 +7072,18 @@ func (q *FakeQuerier) UpdateWorkspaceAgentPortShare(ctx context.Context, arg dat
7072
7072
return err
7073
7073
}
7074
7074
7075
- panic ("not implemented" )
7075
+ q .mutex .Lock ()
7076
+ defer q .mutex .Unlock ()
7077
+
7078
+ for i , share := range q .workspaceAgentPortShares {
7079
+ if share .WorkspaceID == arg .WorkspaceID && share .AgentName == arg .AgentName && share .Port == arg .Port {
7080
+ share .ShareLevel = arg .ShareLevel
7081
+ q .workspaceAgentPortShares [i ] = share
7082
+ return nil
7083
+ }
7084
+ }
7085
+
7086
+ return sql .ErrNoRows
7076
7087
}
7077
7088
7078
7089
func (q * FakeQuerier ) UpdateWorkspaceAgentStartupByID (_ context.Context , arg database.UpdateWorkspaceAgentStartupByIDParams ) error {
0 commit comments