054b432197
CI / lint (pull_request) Successful in 56s
CI / typecheck (pull_request) Successful in 56s
CI / security (pull_request) Successful in 1m2s
CI / quality (pull_request) Successful in 41s
CI / integration_tests (pull_request) Successful in 1m11s
CI / build (pull_request) Successful in 45s
CI / unit_tests (pull_request) Successful in 3m29s
CI / coverage (pull_request) Successful in 3m14s
CI / status-check (pull_request) Successful in 4s
CI / lint (push) Successful in 48s
CI / typecheck (push) Successful in 58s
CI / security (push) Successful in 1m1s
CI / quality (push) Successful in 39s
CI / integration_tests (push) Successful in 1m15s
CI / build (push) Successful in 41s
CI / unit_tests (push) Successful in 3m31s
CI / coverage (push) Successful in 3m27s
CI / status-check (push) Successful in 3s
- Add RegistryCache with LRU eviction, TTL expiry, SHA-1 content validation - Add CacheFactory for centralised cache configuration (Factory Method pattern) - Add CacheStats dataclass for hit/miss/eviction observability - Implement singleflight coalescing for concurrent-miss protection - Use tuple keys for resolve store to prevent separator collision - Fix cancellation-safe singleflight via plain Future + asyncio.shield - Independent max_size budgets per store (content + resolve) - Concurrent test assertions strengthened - All test imports moved to module level per CONTRIBUTING.md - Unused dead code removed from tests ISSUES CLOSED: #28
85 lines
3.2 KiB
Plaintext
85 lines
3.2 KiB
Plaintext
*** Settings ***
|
|
Documentation Integration tests for the RegistryCache against a fake server.
|
|
Library RegistryCacheLib.py
|
|
Library RegistryClientLib.py
|
|
Library Process
|
|
Library OperatingSystem
|
|
Suite Setup Start Fake Registry Server
|
|
Suite Teardown Stop Fake Registry Server
|
|
|
|
*** Variables ***
|
|
${FAKE_SERVER_HOST} 127.0.0.1
|
|
${FAKE_SERVER_PORT} ${9292}
|
|
${VALID_PKG_ID} pkg_act_a1b2c3d4e5f67890abcdef1234567890abcdefab
|
|
${OTHER_PKG_ID} pkg_tpl_1111111111111111111111111111111111111111
|
|
${THIRD_PKG_ID} pkg_tpl_2222222222222222222222222222222222222222
|
|
${NONEXIST_PKG_ID} pkg_act_deadbeef00000000000000000000000000000000
|
|
|
|
*** Keywords ***
|
|
Start Fake Registry Server
|
|
[Documentation] Launch a fake registry server as a subprocess.
|
|
Start Process
|
|
... python robot${/}fake_registry_server.py ${FAKE_SERVER_HOST} ${FAKE_SERVER_PORT}
|
|
... alias=fake_registry
|
|
Sleep 0.5s
|
|
${server_url}= Set Variable http://${FAKE_SERVER_HOST}:${FAKE_SERVER_PORT}
|
|
Set Suite Variable ${SERVER_URL} ${server_url}
|
|
|
|
Stop Fake Registry Server
|
|
[Documentation] Stop the fake server subprocess.
|
|
Terminate Process fake_registry kill=${True}
|
|
|
|
*** Test Cases ***
|
|
Cache Hit Returns Stored Content Without HTTP Call
|
|
[Documentation] Second get_package call should return from cache (hit=1).
|
|
Create Registry Cache ${SERVER_URL}
|
|
Cache Get Package ${VALID_PKG_ID}
|
|
Cache Get Package ${VALID_PKG_ID}
|
|
Cache Stats Hits Equals 1
|
|
Cache Stats Misses Equals 1
|
|
|
|
Cache Miss Increments On First Access
|
|
[Documentation] First get_package call counts as a miss.
|
|
Create Registry Cache ${SERVER_URL}
|
|
Cache Get Package ${VALID_PKG_ID}
|
|
Cache Stats Misses Equals 1
|
|
Cache Stats Hits Equals 0
|
|
|
|
LRU Eviction Evicts Least Recently Used
|
|
[Documentation] When max_size=2 and 3 entries are loaded, the LRU is evicted.
|
|
Create Registry Cache With Config ${SERVER_URL} 2 300
|
|
Cache Get Package ${VALID_PKG_ID}
|
|
Cache Get Package ${OTHER_PKG_ID}
|
|
Cache Stats Evictions Equals 0
|
|
Cache Get Package ${THIRD_PKG_ID}
|
|
Cache Stats Evictions Equals 1
|
|
Cache Should Not Contain ${VALID_PKG_ID}
|
|
Cache Should Contain ${OTHER_PKG_ID}
|
|
Cache Should Contain ${THIRD_PKG_ID}
|
|
|
|
Cache Invalidate Removes Entry
|
|
[Documentation] Invalidating a cached entry returns True.
|
|
Create Registry Cache ${SERVER_URL}
|
|
Cache Get Package ${VALID_PKG_ID}
|
|
Cache Invalidate ${VALID_PKG_ID}
|
|
Invalidate Result Should Be True
|
|
|
|
Cache Invalidate Missing Returns False
|
|
[Documentation] Invalidating a non-existent entry returns False.
|
|
Create Registry Cache ${SERVER_URL}
|
|
Cache Invalidate ${NONEXIST_PKG_ID}
|
|
Invalidate Result Should Be False
|
|
|
|
Cache Clear Resets Statistics
|
|
[Documentation] clear() resets hits and misses to 0.
|
|
Create Registry Cache ${SERVER_URL}
|
|
Cache Get Package ${VALID_PKG_ID}
|
|
Cache Clear
|
|
Cache Stats Hits Equals 0
|
|
Cache Stats Misses Equals 0
|
|
|
|
Cache Close Works Cleanly
|
|
[Documentation] close() shuts down the underlying client and cache.
|
|
Create Registry Cache ${SERVER_URL}
|
|
Close Cache
|