1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
version: 1
style: unit
description: must issue Connections to threads in the order that the threads entered the queue
poolOptions:
maxPoolSize: 1
waitQueueTimeoutMS: 5000
operations:
# Check out sole connection in pool
- name: checkOut
label: conn0
# Create 4 threads, have them all queue up for connections
# Note: this might become non-deterministic depending on how you
# implement your test runner. The goal is for each thread to
# have started and begun checkOut before the next thread starts.
# The sleep operations should make this more consistent.
- name: start
target: thread1
- name: checkOut
thread: thread1
label: conn1
- name: waitForEvent
event: ConnectionCheckOutStarted
count: 2
# Give thread1 some time to actually enter the wait queue since the
# ConnectionCheckOutStarted event is publish beforehand.
- name: wait
ms: 100
- name: start
target: thread2
- name: checkOut
thread: thread2
label: conn2
- name: waitForEvent
event: ConnectionCheckOutStarted
count: 3
# Give thread2 some time to actually enter the wait queue since the
# ConnectionCheckOutStarted event is publish beforehand.
- name: wait
ms: 100
- name: start
target: thread3
- name: checkOut
thread: thread3
label: conn3
- name: waitForEvent
event: ConnectionCheckOutStarted
count: 4
# Give thread3 some time to actually enter the wait queue since the
# ConnectionCheckOutStarted event is publish beforehand.
- name: wait
ms: 100
- name: start
target: thread4
- name: checkOut
thread: thread4
label: conn4
- name: waitForEvent
event: ConnectionCheckOutStarted
count: 5
# Give thread4 some time to actually enter the wait queue since the
# ConnectionCheckOutStarted event is publish beforehand.
- name: wait
ms: 100
# From main thread, keep checking in connection and then wait for appropriate thread
# Test will timeout if threads are not enqueued in proper order
- name: checkIn
connection: conn0
- name: waitForThread
target: thread1
- name: checkIn
connection: conn1
- name: waitForThread
target: thread2
- name: checkIn
connection: conn2
- name: waitForThread
target: thread3
- name: checkIn
connection: conn3
- name: waitForThread
target: thread4
events:
- type: ConnectionCheckOutStarted
address: 42
- type: ConnectionCheckedOut
connectionId: 42
address: 42
- type: ConnectionCheckOutStarted
address: 42
- type: ConnectionCheckOutStarted
address: 42
- type: ConnectionCheckOutStarted
address: 42
- type: ConnectionCheckOutStarted
address: 42
- type: ConnectionCheckedIn
connectionId: 42
address: 42
- type: ConnectionCheckedOut
connectionId: 42
address: 42
- type: ConnectionCheckedIn
connectionId: 42
address: 42
- type: ConnectionCheckedOut
connectionId: 42
address: 42
- type: ConnectionCheckedIn
connectionId: 42
address: 42
- type: ConnectionCheckedOut
connectionId: 42
address: 42
- type: ConnectionCheckedIn
connectionId: 42
address: 42
- type: ConnectionCheckedOut
connectionId: 42
address: 42
ignore:
- ConnectionCreated
- ConnectionReady
- ConnectionClosed
- ConnectionPoolCreated
|