@@ -63,7 +63,7 @@ func TestPerformanceMonitor_SetCache_Mock(t *testing.T) {
6363 ctx := context .Background ()
6464 taskResult := createTestTaskResult ("test-task" , uint64 (time .Now ().Unix ()))
6565 s .Close ()
66-
66+
6767 err := pm .setCache (ctx , taskResult )
6868 assert .Error (t , err )
6969 })
@@ -79,7 +79,7 @@ func TestPerformanceMonitor_Get_Mock(t *testing.T) {
7979
8080 t .Run ("successful Get" , func (t * testing.T ) {
8181 taskResult := createTestTaskResult ("test-task" , uint64 (time .Now ().Unix ()))
82-
82+
8383 ctx := context .Background ()
8484 err := pm .setCache (ctx , taskResult )
8585 require .NoError (t , err )
@@ -109,8 +109,9 @@ func TestPerformanceMonitor_Get_Mock(t *testing.T) {
109109 t .Run ("Get with invalid JSON" , func (t * testing.T ) {
110110 s2 := miniredis .RunT (t )
111111 pm2 , err := newTestPerformanceMonitorWithMockRedis (s2 .Addr ())
112- require .NoError (t , err )
113- s2 .Set (generateKey ("test-task" ), "{invalid json" )
112+ require .NoError (t , err )
113+ err = s2 .Set (generateKey ("test-task" ), "{invalid json" )
114+ require .NoError (t , err )
114115 result , err := pm2 .Get ("test-task" )
115116 assert .Error (t , err )
116117 assert .Contains (t , err .Error (), "failed to unmarshal data from json" )
@@ -164,7 +165,7 @@ func TestPerformanceMonitor_GetAll_Mock(t *testing.T) {
164165 ctx := context .Background ()
165166 task1 := createTestTaskResult ("task1" , uint64 (time .Now ().Unix ()))
166167 task2 := createTestTaskResult ("task2" , uint64 (time .Now ().Unix ()- 100 ))
167-
168+
168169 err := pm .setCache (ctx , task1 )
169170 require .NoError (t , err )
170171 err = pm .setCache (ctx , task2 )
@@ -173,7 +174,7 @@ func TestPerformanceMonitor_GetAll_Mock(t *testing.T) {
173174 results , err := pm .GetAll ()
174175 assert .NoError (t , err )
175176 assert .Len (t , results , 2 )
176-
177+
177178 taskNames := []string {results [0 ].Name , results [1 ].Name }
178179 assert .Contains (t , taskNames , "task1" )
179180 assert .Contains (t , taskNames , "task2" )
@@ -201,13 +202,14 @@ func TestPerformanceMonitor_GetAll_Mock(t *testing.T) {
201202 s3 := miniredis .RunT (t )
202203 pm3 , err := newTestPerformanceMonitorWithMockRedis (s3 .Addr ())
203204 require .NoError (t , err )
204-
205+
205206 ctx := context .Background ()
206207 validTask := createTestTaskResult ("valid-task" , uint64 (time .Now ().Unix ()))
207208 err = pm3 .setCache (ctx , validTask )
208209 require .NoError (t , err )
209-
210- s3 .Set (generateKey ("corrupted-task" ), "{invalid json" )
210+
211+ err = s3 .Set (generateKey ("corrupted-task" ), "{invalid json" )
212+ require .NoError (t , err )
211213
212214 results , err := pm3 .GetAll ()
213215 assert .NoError (t , err )
@@ -235,4 +237,4 @@ func TestGenerateKey(t *testing.T) {
235237 assert .Equal (t , tc .expected , result )
236238 })
237239 }
238- }
240+ }
0 commit comments