@@ -408,4 +408,27 @@ func testTimeSeries(t *testing.T, configs util.KvrocksServerConfigs) {
408408 res = rdb .Do (ctx , "ts.range" , key , "-" , "+" , "AGGREGATION" , "MIN" , 20 , "COUNT" , 1 ).Val ().([]interface {})
409409 assert .Equal (t , 1 , len (res ))
410410 })
411+
412+ t .Run ("TS.GET Basic" , func (t * testing.T ) {
413+ key := "test_get_key"
414+ require .NoError (t , rdb .Del (ctx , key ).Err ())
415+ require .NoError (t , rdb .Do (ctx , "ts.create" , key ).Err ())
416+ // Test GET on empty timeseries
417+ res := rdb .Do (ctx , "ts.get" , key ).Val ().([]interface {})
418+ require .Equal (t , 0 , len (res ))
419+
420+ // Add samples
421+ require .Equal (t , int64 (1000 ), rdb .Do (ctx , "ts.add" , key , "1000" , "12.3" ).Val ())
422+ require .Equal (t , int64 (2000 ), rdb .Do (ctx , "ts.add" , key , "2000" , "15.6" ).Val ())
423+
424+ // Test basic GET
425+ res = rdb .Do (ctx , "ts.get" , key ).Val ().([]interface {})
426+ require .Equal (t , 1 , len (res ))
427+ require .Equal (t , int64 (2000 ), res [0 ].([]interface {})[0 ])
428+ require .Equal (t , 15.6 , res [0 ].([]interface {})[1 ])
429+
430+ // Test GET on non-existent key
431+ _ , err := rdb .Do (ctx , "ts.get" , "nonexistent_key" ).Result ()
432+ require .ErrorContains (t , err , "key does not exist" )
433+ })
411434}
0 commit comments