@@ -89,24 +89,27 @@ func TestGetClusterCapacity(t *testing.T) {
8989 store := NewStore (db )
9090 ctx := context .Background ()
9191
92+ // Use a consistent cluster URL for the test
93+ clusterURL := "http://localhost:31100"
94+
9295 // Initialize cluster with max 10 jobs
93- err := db .InitLocalClusterRecord (ctx , "http://localhost:31100" )
96+ err := db .InitLocalClusterRecord (ctx , clusterURL )
9497 require .NoError (t , err )
9598
9699 // Update cluster details
97- err = store .UpdateClusterDetails (ctx , "http://localhost:31100" , 10 , 10 )
100+ err = store .UpdateClusterDetails (ctx , clusterURL , 10 , 10 )
98101 require .NoError (t , err )
99102
100103 // Get capacity (should be 0 active jobs)
101- maxJobs , activeJobs , err := store .GetClusterCapacity (ctx , "http://localhost:31100" )
104+ maxJobs , activeJobs , err := store .GetClusterCapacity (ctx , clusterURL )
102105 require .NoError (t , err )
103106 assert .Equal (t , 10 , maxJobs )
104107 assert .Equal (t , 0 , activeJobs )
105108
106109 // Create some running jobs
107110 _ , err = store .CreateJob (
108111 ctx ,
109- "http://localhost:31100" ,
112+ clusterURL ,
110113 "test-workflow-1" ,
111114 "test-project" ,
112115 "s3://bucket/images/" ,
@@ -121,7 +124,7 @@ func TestGetClusterCapacity(t *testing.T) {
121124
122125 _ , err = store .CreateJob (
123126 ctx ,
124- "http://localhost:31100" ,
127+ clusterURL ,
125128 "test-workflow-2" ,
126129 "test-project" ,
127130 "s3://bucket/images/" ,
@@ -135,15 +138,15 @@ func TestGetClusterCapacity(t *testing.T) {
135138 require .NoError (t , err )
136139
137140 // Get capacity again (should be 2 active jobs)
138- maxJobs , activeJobs , err = store .GetClusterCapacity (ctx , "http://localhost:31100" )
141+ maxJobs , activeJobs , err = store .GetClusterCapacity (ctx , clusterURL )
139142 require .NoError (t , err )
140143 assert .Equal (t , 10 , maxJobs )
141144 assert .Equal (t , 2 , activeJobs )
142145
143146 // Create a completed job (should not count)
144147 _ , err = store .CreateJob (
145148 ctx ,
146- "http://localhost:31100" ,
149+ clusterURL ,
147150 "test-workflow-3" ,
148151 "test-project" ,
149152 "s3://bucket/images/" ,
@@ -157,7 +160,7 @@ func TestGetClusterCapacity(t *testing.T) {
157160 require .NoError (t , err )
158161
159162 // Get capacity again (should still be 2 active jobs)
160- maxJobs , activeJobs , err = store .GetClusterCapacity (ctx , "http://localhost:31100" )
163+ maxJobs , activeJobs , err = store .GetClusterCapacity (ctx , clusterURL )
161164 require .NoError (t , err )
162165 assert .Equal (t , 10 , maxJobs )
163166 assert .Equal (t , 2 , activeJobs )
0 commit comments