Skip to content

Commit 9c4d102

Browse files
committed
170: Switch to running for a duration rather than a fixed number of iterations.
1 parent d964890 commit 9c4d102

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/RemoteServiceReplication-Test/RsrSocketStressTest.class.st

-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ Class {
55
#package : 'RemoteServiceReplication-Test'
66
}
77

8-
{ #category : 'accessing' }
9-
RsrSocketStressTest class >> defaultTimeLimit [
10-
"These tests take longer over a Socket"
11-
12-
^120 seconds
13-
]
14-
158
{ #category : 'testing' }
169
RsrSocketStressTest class >> isAbstract [
1710

src/RemoteServiceReplication-Test/RsrStressTest.class.st

+20-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Class {
1212
{ #category : 'accessing' }
1313
RsrStressTest class >> defaultTimeLimit [
1414

15-
^30 seconds
15+
^Duration seconds: 30
1616
]
1717

1818
{ #category : 'testing' }
@@ -44,6 +44,12 @@ RsrStressTest >> concurrentlyRun: aBlock [
4444
self deny: anyCurtailed
4545
]
4646

47+
{ #category : 'accessing' }
48+
RsrStressTest >> defaultTestDuration [
49+
50+
^self class defaultTimeLimit / 2
51+
]
52+
4753
{ #category : 'initialize/release' }
4854
RsrStressTest >> initializeServices [
4955

@@ -63,19 +69,25 @@ RsrStressTest >> numThreads [
6369
{ #category : 'running-utilities' }
6470
RsrStressTest >> repeatedlyRun: aBlock [
6571

66-
self repetitions timesRepeat: aBlock
72+
| endTime |
73+
endTime := DateAndTime now + self defaultTestDuration.
74+
self
75+
repeatedlyRun: aBlock
76+
until: endTime
6777
]
6878

6979
{ #category : 'running-utilities' }
70-
RsrStressTest >> repeatedlySend: anObject [
80+
RsrStressTest >> repeatedlyRun: aBlock
81+
until: endTime [
7182

72-
self repeatedlyRun: [self send: anObject]
83+
[DateAndTime now < endTime]
84+
whileTrue: [aBlock value]
7385
]
7486

75-
{ #category : 'accessing' }
76-
RsrStressTest >> repetitions [
87+
{ #category : 'running-utilities' }
88+
RsrStressTest >> repeatedlySend: anObject [
7789

78-
^1000
90+
self repeatedlyRun: [self send: anObject]
7991
]
8092

8193
{ #category : 'running-utilities' }
@@ -109,11 +121,7 @@ RsrStressTest >> tearDown [
109121
{ #category : 'running' }
110122
RsrStressTest >> test10MBytes [
111123

112-
| bytes |
113-
bytes := ByteArray new: 1024 * 1024 * 10.
114-
1
115-
to: 10
116-
do: [:i | self send: bytes]
124+
self repeatedlySend: (ByteArray new: 1024 * 1024 * 10)
117125
]
118126

119127
{ #category : 'running' }

0 commit comments

Comments
 (0)