File tree Expand file tree Collapse file tree
tests/Microsoft.Azure.Cosmos.Tests/ChangeFeed Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -258,28 +258,13 @@ public virtual ChangeFeedProcessorBuilder WithInMemoryLeaseContainer(MemoryStrea
258258 throw new ArgumentNullException ( nameof ( leaseState ) ) ;
259259 }
260260
261+ this . ValidateNoLeaseContainerConfigured ( ) ;
262+
261263 if ( ! leaseState . CanWrite )
262264 {
263265 throw new ArgumentException ( "The lease state stream must be writable so that state can be persisted on shutdown." , nameof ( leaseState ) ) ;
264266 }
265267
266- // Verify the stream is expandable. A MemoryStream created via
267- // new MemoryStream(byte[]) is writable but not expandable and will
268- // throw NotSupportedException when ShutdownAsync tries to resize it.
269- try
270- {
271- leaseState . SetLength ( leaseState . Length ) ;
272- }
273- catch ( NotSupportedException )
274- {
275- throw new ArgumentException (
276- "The lease state stream must be resizable. Use 'new MemoryStream()' and write bytes into it "
277- + "instead of 'new MemoryStream(byte[])' to create a resizable stream." ,
278- nameof ( leaseState ) ) ;
279- }
280-
281- this . ValidateNoLeaseContainerConfigured ( ) ;
282-
283268 if ( string . IsNullOrEmpty ( this . InstanceName ) )
284269 {
285270 this . InstanceName = ChangeFeedProcessorBuilder . InMemoryDefaultHostName ;
Original file line number Diff line number Diff line change @@ -551,24 +551,6 @@ public void WithInMemoryLeaseContainerWithCorruptedStreamThrowsInvalidOperation(
551551 Assert . IsNotNull ( ex . InnerException ) ;
552552 }
553553
554- [ TestMethod ]
555- public void WithInMemoryLeaseContainerWithNonResizableStreamThrows ( )
556- {
557- // new MemoryStream(byte[]) creates a writable but non-expandable stream
558- byte [ ] data = System . Text . Encoding . UTF8 . GetBytes ( "[]" ) ;
559- MemoryStream nonResizableStream = new MemoryStream ( data ) ;
560-
561- ChangeFeedProcessorBuilder builder = new ChangeFeedProcessorBuilder ( "workflowName" ,
562- ChangeFeedProcessorBuilderTests . GetMockedContainer ( ) ,
563- ChangeFeedProcessorBuilderTests . GetMockedProcessor ( ) ,
564- ChangeFeedProcessorBuilderTests . GetEmptyInitialization ( ) ) ;
565-
566- ArgumentException ex = Assert . ThrowsException < ArgumentException > (
567- ( ) => builder . WithInMemoryLeaseContainer ( nonResizableStream ) ) ;
568-
569- Assert . IsTrue ( ex . Message . Contains ( "resizable" ) ) ;
570- }
571-
572554 #endregion
573555
574556 private static ContainerInternal GetMockedContainer ( string containerName = null )
You can’t perform that action at this time.
0 commit comments