@@ -63,7 +63,7 @@ func TestPerformanceMonitor_SetCache_Mock(t *testing.T) {
63
63
ctx := context .Background ()
64
64
taskResult := createTestTaskResult ("test-task" , uint64 (time .Now ().Unix ()))
65
65
s .Close ()
66
-
66
+
67
67
err := pm .setCache (ctx , taskResult )
68
68
assert .Error (t , err )
69
69
})
@@ -79,7 +79,7 @@ func TestPerformanceMonitor_Get_Mock(t *testing.T) {
79
79
80
80
t .Run ("successful Get" , func (t * testing.T ) {
81
81
taskResult := createTestTaskResult ("test-task" , uint64 (time .Now ().Unix ()))
82
-
82
+
83
83
ctx := context .Background ()
84
84
err := pm .setCache (ctx , taskResult )
85
85
require .NoError (t , err )
@@ -109,7 +109,7 @@ func TestPerformanceMonitor_Get_Mock(t *testing.T) {
109
109
t .Run ("Get with invalid JSON" , func (t * testing.T ) {
110
110
s2 := miniredis .RunT (t )
111
111
pm2 , err := newTestPerformanceMonitorWithMockRedis (s2 .Addr ())
112
- require .NoError (t , err )
112
+ require .NoError (t , err )
113
113
s2 .Set (generateKey ("test-task" ), "{invalid json" )
114
114
result , err := pm2 .Get ("test-task" )
115
115
assert .Error (t , err )
@@ -164,7 +164,7 @@ func TestPerformanceMonitor_GetAll_Mock(t *testing.T) {
164
164
ctx := context .Background ()
165
165
task1 := createTestTaskResult ("task1" , uint64 (time .Now ().Unix ()))
166
166
task2 := createTestTaskResult ("task2" , uint64 (time .Now ().Unix ()- 100 ))
167
-
167
+
168
168
err := pm .setCache (ctx , task1 )
169
169
require .NoError (t , err )
170
170
err = pm .setCache (ctx , task2 )
@@ -173,7 +173,7 @@ func TestPerformanceMonitor_GetAll_Mock(t *testing.T) {
173
173
results , err := pm .GetAll ()
174
174
assert .NoError (t , err )
175
175
assert .Len (t , results , 2 )
176
-
176
+
177
177
taskNames := []string {results [0 ].Name , results [1 ].Name }
178
178
assert .Contains (t , taskNames , "task1" )
179
179
assert .Contains (t , taskNames , "task2" )
@@ -201,12 +201,12 @@ func TestPerformanceMonitor_GetAll_Mock(t *testing.T) {
201
201
s3 := miniredis .RunT (t )
202
202
pm3 , err := newTestPerformanceMonitorWithMockRedis (s3 .Addr ())
203
203
require .NoError (t , err )
204
-
204
+
205
205
ctx := context .Background ()
206
206
validTask := createTestTaskResult ("valid-task" , uint64 (time .Now ().Unix ()))
207
207
err = pm3 .setCache (ctx , validTask )
208
208
require .NoError (t , err )
209
-
209
+
210
210
s3 .Set (generateKey ("corrupted-task" ), "{invalid json" )
211
211
212
212
results , err := pm3 .GetAll ()
@@ -235,4 +235,5 @@ func TestGenerateKey(t *testing.T) {
235
235
assert .Equal (t , tc .expected , result )
236
236
})
237
237
}
238
- }
238
+ }
239
+
0 commit comments