@@ -68,24 +68,84 @@ public void Dispose()
68
68
}
69
69
70
70
[ Test ]
71
- public void TestConcurrentChannelOpenWithPublishing ( )
71
+ public void TestConcurrentChannelOpenAndPublishingWithBlankMessages ( )
72
72
{
73
- TestConcurrentChannelOperations ( ( conn ) => {
74
- // publishing on a shared channel is not supported
75
- // and would missing the point of this test anyway
76
- var ch = Conn . CreateModel ( ) ;
77
- ch . ConfirmSelect ( ) ;
78
- foreach ( var j in Enumerable . Range ( 0 , 500 ) )
79
- {
80
- var body = Encoding . ASCII . GetBytes ( string . Empty ) ;
81
- ch . BasicPublish ( exchange : "" , routingKey : "_______" , basicProperties : ch . CreateBasicProperties ( ) , body : body ) ;
82
- }
83
- ch . WaitForConfirms ( TimeSpan . FromSeconds ( 40 ) ) ;
84
- } , 30 ) ;
73
+ TestConcurrentChannelOpenAndPublishingWithBody ( Encoding . ASCII . GetBytes ( string . Empty ) , 30 ) ;
74
+ }
75
+
76
+ [ Test ]
77
+ public void TestConcurrentChannelOpenAndPublishingCase1 ( )
78
+ {
79
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 64 ) ;
80
+ }
81
+
82
+ [ Test ]
83
+ public void TestConcurrentChannelOpenAndPublishingCase2 ( )
84
+ {
85
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 256 ) ;
86
+ }
87
+
88
+ [ Test ]
89
+ public void TestConcurrentChannelOpenAndPublishingCase3 ( )
90
+ {
91
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 1024 ) ;
92
+ }
93
+
94
+ [ Test ]
95
+ public void TestConcurrentChannelOpenAndPublishingCase4 ( )
96
+ {
97
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 8192 ) ;
98
+ }
99
+
100
+ [ Test ]
101
+ public void TestConcurrentChannelOpenAndPublishingCase5 ( )
102
+ {
103
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 32768 , 20 ) ;
104
+ }
105
+
106
+ [ Test ]
107
+ public void TestConcurrentChannelOpenAndPublishingCase6 ( )
108
+ {
109
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 100000 , 15 ) ;
110
+ }
111
+
112
+ [ Test ]
113
+ public void TestConcurrentChannelOpenAndPublishingCase7 ( )
114
+ {
115
+ // surpasses default frame size
116
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 131072 , 12 ) ;
117
+ }
118
+
119
+ [ Test ]
120
+ public void TestConcurrentChannelOpenAndPublishingCase8 ( )
121
+ {
122
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 270000 , 10 ) ;
123
+ }
124
+
125
+ [ Test ]
126
+ public void TestConcurrentChannelOpenAndPublishingCase9 ( )
127
+ {
128
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 540000 , 6 ) ;
129
+ }
130
+
131
+ [ Test ]
132
+ public void TestConcurrentChannelOpenAndPublishingCase10 ( )
133
+ {
134
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 1000000 , 2 ) ;
135
+ }
136
+
137
+ [ Test ]
138
+ public void TestConcurrentChannelOpenAndPublishingCase11 ( )
139
+ {
140
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 1500000 , 1 ) ;
141
+ }
142
+
143
+ [ Test ]
144
+ public void TestConcurrentChannelOpenAndPublishingCase12 ( )
145
+ {
146
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( 128000000 , 1 ) ;
85
147
}
86
148
87
- // note: refactoring this further to use an Action causes .NET Core 1.x
88
- // to segfault on OS X for no obvious reason
89
149
[ Test ]
90
150
public void TestConcurrentChannelOpenCloseLoop ( )
91
151
{
@@ -95,6 +155,37 @@ public void TestConcurrentChannelOpenCloseLoop()
95
155
} , 50 ) ;
96
156
}
97
157
158
+ protected void TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( int length )
159
+ {
160
+ TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( length , 30 ) ;
161
+ }
162
+
163
+ protected void TestConcurrentChannelOpenAndPublishingWithBodyOfSize ( int length , int iterations )
164
+ {
165
+ string s = "payload" ;
166
+ if ( length > s . Length )
167
+ {
168
+ s . PadRight ( length ) ;
169
+ }
170
+
171
+ TestConcurrentChannelOpenAndPublishingWithBody ( Encoding . ASCII . GetBytes ( s ) , iterations ) ;
172
+ }
173
+
174
+ protected void TestConcurrentChannelOpenAndPublishingWithBody ( byte [ ] body , int iterations )
175
+ {
176
+ TestConcurrentChannelOperations ( ( conn ) => {
177
+ // publishing on a shared channel is not supported
178
+ // and would missing the point of this test anyway
179
+ var ch = Conn . CreateModel ( ) ;
180
+ ch . ConfirmSelect ( ) ;
181
+ foreach ( var j in Enumerable . Range ( 0 , 200 ) )
182
+ {
183
+ ch . BasicPublish ( exchange : "" , routingKey : "_______" , basicProperties : ch . CreateBasicProperties ( ) , body : body ) ;
184
+ }
185
+ ch . WaitForConfirms ( TimeSpan . FromSeconds ( 40 ) ) ;
186
+ } , iterations ) ;
187
+ }
188
+
98
189
protected void TestConcurrentChannelOperations ( Action < IConnection > actions ,
99
190
int iterations )
100
191
{
0 commit comments