@@ -665,13 +665,23 @@ func (s *MethodTestSuite) TestWorkspaceProxy() {
665
665
p , _ := dbgen .WorkspaceProxy (s .T (), db , database.WorkspaceProxy {})
666
666
check .Args (p .ID ).Asserts (p , rbac .ActionRead ).Returns (p )
667
667
}))
668
+ s .Run ("GetWorkspaceProxyByName" , s .Subtest (func (db database.Store , check * expects ) {
669
+ p , _ := dbgen .WorkspaceProxy (s .T (), db , database.WorkspaceProxy {})
670
+ check .Args (p .Name ).Asserts (p , rbac .ActionRead ).Returns (p )
671
+ }))
668
672
s .Run ("UpdateWorkspaceProxyDeleted" , s .Subtest (func (db database.Store , check * expects ) {
669
673
p , _ := dbgen .WorkspaceProxy (s .T (), db , database.WorkspaceProxy {})
670
674
check .Args (database.UpdateWorkspaceProxyDeletedParams {
671
675
ID : p .ID ,
672
676
Deleted : true ,
673
677
}).Asserts (p , rbac .ActionDelete )
674
678
}))
679
+ s .Run ("UpdateWorkspaceProxy" , s .Subtest (func (db database.Store , check * expects ) {
680
+ p , _ := dbgen .WorkspaceProxy (s .T (), db , database.WorkspaceProxy {})
681
+ check .Args (database.UpdateWorkspaceProxyParams {
682
+ ID : p .ID ,
683
+ }).Asserts (p , rbac .ActionUpdate )
684
+ }))
675
685
s .Run ("GetWorkspaceProxies" , s .Subtest (func (db database.Store , check * expects ) {
676
686
p1 , _ := dbgen .WorkspaceProxy (s .T (), db , database.WorkspaceProxy {})
677
687
p2 , _ := dbgen .WorkspaceProxy (s .T (), db , database.WorkspaceProxy {})
@@ -899,6 +909,15 @@ func (s *MethodTestSuite) TestTemplate() {
899
909
//tpl := dbgen.Template(s.T(), db, database.Template{})
900
910
check .Args (database.GetTemplateInsightsParams {}).Asserts (rbac .ResourceTemplateInsights , rbac .ActionRead )
901
911
}))
912
+ s .Run ("GetUserLatencyInsights" , s .Subtest (func (db database.Store , check * expects ) {
913
+ check .Args (database.GetUserLatencyInsightsParams {}).Asserts (rbac .ResourceTemplateInsights , rbac .ActionRead )
914
+ }))
915
+ s .Run ("GetUserActivityInsights" , s .Subtest (func (db database.Store , check * expects ) {
916
+ check .Args (database.GetUserActivityInsightsParams {}).Asserts (rbac .ResourceTemplateInsights , rbac .ActionRead )
917
+ }))
918
+ s .Run ("GetTemplateParameterInsights" , s .Subtest (func (db database.Store , check * expects ) {
919
+ check .Args (database.GetTemplateParameterInsightsParams {}).Asserts (rbac .ResourceTemplateInsights , rbac .ActionRead )
920
+ }))
902
921
s .Run ("GetTemplateInsightsByInterval" , s .Subtest (func (db database.Store , check * expects ) {
903
922
check .Args (database.GetTemplateInsightsByIntervalParams {}).Asserts (rbac .ResourceTemplateInsights , rbac .ActionRead )
904
923
}))
@@ -1416,6 +1435,19 @@ func (s *MethodTestSuite) TestWorkspace() {
1416
1435
ID : w .ID ,
1417
1436
}).Asserts (w , rbac .ActionUpdate ).Returns (expected )
1418
1437
}))
1438
+ s .Run ("UpdateWorkspaceDormantDeletingAt" , s .Subtest (func (db database.Store , check * expects ) {
1439
+ w := dbgen .Workspace (s .T (), db , database.Workspace {})
1440
+ check .Args (database.UpdateWorkspaceDormantDeletingAtParams {
1441
+ ID : w .ID ,
1442
+ }).Asserts (w , rbac .ActionUpdate )
1443
+ }))
1444
+ s .Run ("UpdateWorkspaceAutomaticUpdates" , s .Subtest (func (db database.Store , check * expects ) {
1445
+ w := dbgen .Workspace (s .T (), db , database.Workspace {})
1446
+ check .Args (database.UpdateWorkspaceAutomaticUpdatesParams {
1447
+ ID : w .ID ,
1448
+ AutomaticUpdates : database .AutomaticUpdatesAlways ,
1449
+ }).Asserts (w , rbac .ActionUpdate )
1450
+ }))
1419
1451
s .Run ("InsertWorkspaceAgentStat" , s .Subtest (func (db database.Store , check * expects ) {
1420
1452
ws := dbgen .Workspace (s .T (), db , database.Workspace {})
1421
1453
check .Args (database.InsertWorkspaceAgentStatParams {
@@ -2053,4 +2085,16 @@ func (s *MethodTestSuite) TestSystemFunctions() {
2053
2085
s .Run ("GetWorkspaceAgentStats" , s .Subtest (func (db database.Store , check * expects ) {
2054
2086
check .Args (time.Time {}).Asserts ()
2055
2087
}))
2088
+ s .Run ("GetWorkspaceProxyByHostname" , s .Subtest (func (db database.Store , check * expects ) {
2089
+ p , _ := dbgen .WorkspaceProxy (s .T (), db , database.WorkspaceProxy {
2090
+ WildcardHostname : "*.example.com" ,
2091
+ })
2092
+ check .Args (database.GetWorkspaceProxyByHostnameParams {
2093
+ Hostname : "foo.example.com" ,
2094
+ AllowWildcardHostname : true ,
2095
+ }).Asserts (rbac .ResourceSystem , rbac .ActionRead ).Returns (p )
2096
+ }))
2097
+ s .Run ("GetTemplateAverageBuildTime" , s .Subtest (func (db database.Store , check * expects ) {
2098
+ check .Args (database.GetTemplateAverageBuildTimeParams {}).Asserts (rbac .ResourceSystem , rbac .ActionRead )
2099
+ }))
2056
2100
}
0 commit comments