@@ -232,3 +232,34 @@ def test_old_database_without_configs_table(temp_dir):
232232
233233 all_configs = SQLiteStorage .get_all_run_configs ("test" )
234234 assert all_configs == {}
235+
236+
237+ def test_get_runs_returns_chronological_order (temp_dir ):
238+ db_path = SQLiteStorage .get_project_db_path ("proj" )
239+ db_path .parent .mkdir (parents = True , exist_ok = True )
240+
241+ with sqlite3 .connect (db_path ) as conn :
242+ conn .execute ("""
243+ CREATE TABLE metrics (
244+ id INTEGER PRIMARY KEY,
245+ timestamp TEXT,
246+ run_name TEXT,
247+ step INTEGER,
248+ metrics TEXT
249+ )
250+ """ )
251+ conn .execute (
252+ "INSERT INTO metrics (timestamp, run_name, step, metrics) VALUES (?, ?, ?, ?)" ,
253+ ("2024-01-01" , "run-z" , 0 , orjson .dumps ({"loss" : 0.5 })),
254+ )
255+ conn .execute (
256+ "INSERT INTO metrics (timestamp, run_name, step, metrics) VALUES (?, ?, ?, ?)" ,
257+ ("2024-01-02" , "run-a" , 0 , orjson .dumps ({"loss" : 0.5 })),
258+ )
259+ conn .execute (
260+ "INSERT INTO metrics (timestamp, run_name, step, metrics) VALUES (?, ?, ?, ?)" ,
261+ ("2024-01-03" , "run-m" , 0 , orjson .dumps ({"loss" : 0.5 })),
262+ )
263+
264+ runs = SQLiteStorage .get_runs ("proj" )
265+ assert runs == ["run-z" , "run-a" , "run-m" ]
0 commit comments