MCPcopy Create free account
hub / github.com/FastLED/FastLED / test_record_operations

Function test_record_operations

ci/docker_utils/test_container_db.py:50–84  ·  view source on GitHub ↗

Test basic CRUD operations.

()

Source from the content-addressed store, hash-verified

48
49
50def test_record_operations():
51 """Test basic CRUD operations."""
52 print("Testing record operations...")
53
54 with tempfile.TemporaryDirectory() as tmpdir:
55 db_path = Path(tmpdir) / "test.db"
56 db = ContainerDatabase(db_path)
57
58 # Insert a record
59 container_id = "test_container_123"
60 container_name = "test-container"
61 image_name = "test-image:latest"
62 owner_pid = os.getpid()
63
64 db.insert(container_id, container_name, image_name, owner_pid)
65
66 # Retrieve by name
67 record = db.get_by_name(container_name)
68 assert record is not None, "Failed to retrieve record by name"
69 assert record.container_id == container_id
70 assert record.container_name == container_name
71 assert record.image_name == image_name
72 assert record.owner_pid == owner_pid
73
74 # Retrieve by ID
75 record = db.get_by_id(container_id)
76 assert record is not None, "Failed to retrieve record by ID"
77 assert record.container_id == container_id
78
79 # Delete by ID
80 db.delete_by_id(container_id)
81 record = db.get_by_id(container_id)
82 assert record is None, "Record was not deleted"
83
84 print("✓ Record operations test passed")
85
86
87def test_orphan_detection():

Callers 1

mainFunction · 0.85

Calls 6

insertMethod · 0.95
get_by_nameMethod · 0.95
get_by_idMethod · 0.95
delete_by_idMethod · 0.95
ContainerDatabaseClass · 0.90
printFunction · 0.50

Tested by

no test coverage detected