
Reference implementations
The websemaphore examples repo on GitHub provides a starting point for both http and websockets -based flows. Check it out:
Full l
Basic job operations
| Test Name | Purpose | WebSockets | HTTP |
|---|---|---|---|
_01_basic | Basic happy path test: acquire, process, and release a lock. | 01-websockets-basic.ts | 01-http-basic.ts |
_02_timeout | Test job timeout behavior. | 02-websockets-timeout.ts | 02-http-timeout.ts |
_03_reschedule | Basic reschedule test: timeout a job, reschedule it, and verify it retains its properties. | 03-websockets-reschedule-basic.ts | 03-http-reschedule-basic.ts |
_04_reschedule_order | Verify that rescheduled jobs are processed before newer jobs. | 04-websockets-reschedule-order.ts | 04-http-reschedule-order.ts |
_05_requeue | Requeue a timed-out job and verify it retains its payload but gets a new CRN. | 05-websockets-requeue.ts | 05-http-requeue.ts |
_06_cancel | Cancel a job during processing and verify it transitions to the archived state. | 06-websockets-cancel.ts | 06-http-cancel.ts |
_07_delete | Delete a timed-out job and verify it transitions to the archived state. | 07-websockets-delete.ts | 07-http-delete-test.ts |
Mapping, failover and advanced routing
| Test Name | Purpose | File Name |
|---|---|---|
_10_mapping_basic | Test dynamic mapping | 10-websockets-mapping-basic.ts |
_11_mapping_change_transport | Change transport in mapping from WebSockets to HTTP. | 11-mapping-change-transport.ts |
_21_transport_http_fallback | Fall back to HTTP when WebSocket connection drops. | 21-transport-http-fallback.ts |
_22_transport_websemaphore_fallback | Fallback to another WebSemaphore when all other options fail. | 22-transport-websemaphore-fallback.ts |
Concurrency control and channels
| Test Name | Purpose | File Name |
|---|---|---|
_33_channel_distinction | Verify that jobs on different channels are processed independently. | 33-channel-distinction.ts |
_34_channel_suspension | Verify that deactivating one channel does not affect the functionality of another channel. | 34-channel-suspension.ts |
_35_concurrency_control | Verify that the semaphore respects maxValue when processing multiple jobs concurrently. | 35-concurrency-control.ts |
