-
Notifications
You must be signed in to change notification settings - Fork 57
Strict concurrency for tests #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| channel.eventLoop.makeFailedFuture(MultiplexerTestError.rejected) | ||
| channel.eventLoop.makeCompletedFuture { | ||
| let sync = channel.pipeline.syncOperations | ||
| try sync.addHandler(errorLogger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: any reason we need sync variable? why not just chain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason beyond habit!
| // Issue a write to the child. | ||
| var bytes = channel.allocator.buffer(capacity: 1024) | ||
| bytes.writeString("Hello from the unit tests") | ||
| XCTAssertThrowsError(try channel.writeAndFlush(SSHChannelData(type: .channel, data: .byteBuffer(bytes))).wait()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to rewrite this because of "non-sendable" warning on SSHChannelData? My PR should address this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I'll fix these up.
| buffer.writeString("Hello from the unit tests!") | ||
|
|
||
| for _ in 0..<5 { | ||
| channel.write(SSHChannelData(type: .channel, data: .byteBuffer(buffer)), promise: nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
| let finalWriteComplete = NIOLoopBoundBox(false, eventLoop: channel.eventLoop) | ||
| let eofComplete = NIOLoopBoundBox(false, eventLoop: channel.eventLoop) | ||
|
|
||
| channel.write(SSHChannelData(type: .channel, data: .byteBuffer(buffer))).whenSuccess { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
| // Now write some data. This fails immediately. | ||
| XCTAssertThrowsError( | ||
| try channel.write( | ||
| SSHChannelData(type: .channel, data: .byteBuffer(channel.allocator.buffer(capacity: 1024))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
artemredkin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coulpe of minor suggestions but otherwise looks good
| channel.eventLoop.makeFailedFuture(MultiplexerTestError.rejected) | ||
| channel.eventLoop.makeCompletedFuture { | ||
| let sync = channel.pipeline.syncOperations | ||
| try sync.addHandler(errorLogger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason beyond habit!
| // Issue a write to the child. | ||
| var bytes = channel.allocator.buffer(capacity: 1024) | ||
| bytes.writeString("Hello from the unit tests") | ||
| XCTAssertThrowsError(try channel.writeAndFlush(SSHChannelData(type: .channel, data: .byteBuffer(bytes))).wait()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I'll fix these up.
No description provided.