@@ -146,7 +146,7 @@ type data struct {
146
146
workspaceAgentLogs []database.WorkspaceAgentLog
147
147
workspaceAgentLogSources []database.WorkspaceAgentLogSource
148
148
workspaceAgentScripts []database.WorkspaceAgentScript
149
- workspaceAgentPortShare []database.WorkspaceAgentPortShare
149
+ workspaceAgentPortShares []database.WorkspaceAgentPortShare
150
150
workspaceApps []database.WorkspaceApp
151
151
workspaceAppStatsLastInsertID int64
152
152
workspaceAppStats []database.WorkspaceAppStat
@@ -1011,14 +1011,14 @@ func (q *FakeQuerier) CreateWorkspaceAgentPortShare(_ context.Context, arg datab
1011
1011
q .mutex .Lock ()
1012
1012
defer q .mutex .Unlock ()
1013
1013
1014
- for _ , share := range q .workspaceAgentPortShare {
1014
+ for _ , share := range q .workspaceAgentPortShares {
1015
1015
if share .WorkspaceID == arg .WorkspaceID && share .AgentName == arg .AgentName && share .Port == arg .Port {
1016
1016
return xerrors .New ("port share already exists" )
1017
1017
}
1018
1018
}
1019
1019
1020
1020
//nolint:gosimple // I disagree
1021
- q .workspaceAgentPortShare = append (q .workspaceAgentPortShare , database.WorkspaceAgentPortShare {
1021
+ q .workspaceAgentPortShares = append (q .workspaceAgentPortShares , database.WorkspaceAgentPortShare {
1022
1022
WorkspaceID : arg .WorkspaceID ,
1023
1023
AgentName : arg .AgentName ,
1024
1024
Port : arg .Port ,
@@ -1352,9 +1352,9 @@ func (q *FakeQuerier) DeleteWorkspaceAgentPortShare(_ context.Context, arg datab
1352
1352
q .mutex .Lock ()
1353
1353
defer q .mutex .Unlock ()
1354
1354
1355
- for i , share := range q .workspaceAgentPortShare {
1355
+ for i , share := range q .workspaceAgentPortShares {
1356
1356
if share .WorkspaceID == arg .WorkspaceID && share .AgentName == arg .AgentName && share .Port == arg .Port {
1357
- q .workspaceAgentPortShare = append (q .workspaceAgentPortShare [:i ], q .workspaceAgentPortShare [i + 1 :]... )
1357
+ q .workspaceAgentPortShares = append (q .workspaceAgentPortShares [:i ], q .workspaceAgentPortShares [i + 1 :]... )
1358
1358
return nil
1359
1359
}
1360
1360
}
@@ -4131,7 +4131,7 @@ func (q *FakeQuerier) GetWorkspaceAgentPortShare(_ context.Context, arg database
4131
4131
q .mutex .RLock ()
4132
4132
defer q .mutex .RUnlock ()
4133
4133
4134
- for _ , share := range q .workspaceAgentPortShare {
4134
+ for _ , share := range q .workspaceAgentPortShares {
4135
4135
if share .WorkspaceID == arg .WorkspaceID && share .AgentName == arg .AgentName && share .Port == arg .Port {
4136
4136
return share , nil
4137
4137
}
@@ -6993,7 +6993,18 @@ func (q *FakeQuerier) UpdateWorkspaceAgentPortShare(ctx context.Context, arg dat
6993
6993
return err
6994
6994
}
6995
6995
6996
- panic ("not implemented" )
6996
+ q .mutex .Lock ()
6997
+ defer q .mutex .Unlock ()
6998
+
6999
+ for i , share := range q .workspaceAgentPortShares {
7000
+ if share .WorkspaceID == arg .WorkspaceID && share .AgentName == arg .AgentName && share .Port == arg .Port {
7001
+ share .ShareLevel = arg .ShareLevel
7002
+ q .workspaceAgentPortShares [i ] = share
7003
+ return nil
7004
+ }
7005
+ }
7006
+
7007
+ return sql .ErrNoRows
6997
7008
}
6998
7009
6999
7010
func (q * FakeQuerier ) UpdateWorkspaceAgentStartupByID (_ context.Context , arg database.UpdateWorkspaceAgentStartupByIDParams ) error {
0 commit comments