File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed
Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,19 @@ python3 src/slurm_schema.py --output schema.json
130130The resulting ` schema.json ` file can be compared with the list of
131131tables and columns from your deployment.
132132
133+ ### Testing with sample SlurmDB data
134+
135+ For unit tests and local development the repository includes two fixtures
136+ under ` test/ ` :
137+
138+ - ` example_slurm_schema_for_testing.json ` – a pre-generated mapping of
139+ tables to columns for a minimal Slurm accounting database.
140+ - ` example_slurmdb_for_testing.sql ` – a small SQL dump containing the
141+ corresponding table definitions and a few dummy rows.
142+
143+ These files allow tests to verify table and column presence and operate on
144+ sample data without requiring access to a live SlurmDB instance.
145+
133146## 📝 Development Notes
134147
135148- Your UI components can access system files or commands using ` cockpit.file() ` and other Cockpit APIs.
Original file line number Diff line number Diff line change 44
55class SlurmSchemaDumpTests (unittest .TestCase ):
66 def test_job_table_uses_cpus_req (self ):
7- schema = extract_schema_from_dump ('test/test_db_dump .sql' )
7+ schema = extract_schema_from_dump ('test/example_slurmdb_for_testing .sql' )
88 cols = schema .get ('localcluster_job_table' , [])
99 self .assertIn ('cpus_req' , cols )
1010 self .assertNotIn ('cpus_alloc' , cols )
Original file line number Diff line number Diff line change 11import unittest
2+ import json
23from slurmdb import SlurmDB
3- from slurm_schema import extract_schema_from_dump , extract_schema
4+ from slurm_schema import extract_schema
45
56class SlurmDBValidationTests (unittest .TestCase ):
67 def test_invalid_cluster_rejected (self ):
@@ -150,7 +151,8 @@ def fake_connect():
150151 self .assertIsNone (db ._conn )
151152
152153 def test_fetch_usage_records_uses_cpus_req_if_alloc_missing (self ):
153- schema = extract_schema_from_dump ('test/test_db_dump.sql' )
154+ with open ('test/example_slurm_schema_for_testing.json' ) as fh :
155+ schema = json .load (fh )
154156 job_cols = schema .get ('localcluster_job_table' , [])
155157
156158 class FakeCursor :
You can’t perform that action at this time.
0 commit comments