File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
modules/core-services/services/project Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -761,7 +761,7 @@ func (p *Project) fetchPodInfo(dto *apistructs.ProjectDTO) {
761761 return
762762 }
763763 var podInfos []apistructs.PodInfo
764- if err := p .db .Find (& podInfos , map [ string ] interface {}{ "project_id" : dto .ID , "phase" : "running" } ).Error ; err != nil {
764+ if err := p .db .Find (& podInfos , RunningPodCond ( dto .ID ) ).Error ; err != nil {
765765 logrus .WithError (err ).WithField ("project_id" , dto .ID ).
766766 Warnln ("failed to Find the namespaces info in the project" )
767767 return
@@ -1584,3 +1584,10 @@ func (p *Project) ListUnblockAppCountsByProjectIDS(projectIDS []uint64) ([]model
15841584 }
15851585 return p .db .ListUnblockAppCountsByProjectIDS (projectIDS )
15861586}
1587+
1588+ func RunningPodCond (projectID uint64 ) map [string ]interface {} {
1589+ return map [string ]interface {}{
1590+ "project_id" : strconv .FormatUint (projectID , 10 ),
1591+ "phase" : "running" ,
1592+ }
1593+ }
Original file line number Diff line number Diff line change @@ -398,3 +398,13 @@ func TestGetNotFoundProject(t *testing.T) {
398398 _ , err := p .Get (context .Background (), 1 , true )
399399 assert .Equal (t , dao .ErrNotFoundProject , err )
400400}
401+
402+ func TestRunningPodCond (t * testing.T ) {
403+ cond := RunningPodCond (1 )
404+ if cond ["project_id" ] != "1" {
405+ t .Fatal ("error" )
406+ }
407+ if cond ["phase" ] != "running" {
408+ t .Fatal ("error" )
409+ }
410+ }
You can’t perform that action at this time.
0 commit comments