[Twisted-Python] SMB server component for twisted

Glyph glyph at twistedmatrix.com
Sat May 9 04:11:34 MDT 2020



> On May 8, 2020, at 12:39 AM, Ian Haywood <ian at haywood.id.au> wrote:
> 
> On 7/05/2020 5:48 pm, Glyph wrote:
> 
>> If you want to include it in Twisted itself, your best bet is to actually develop it /within/ twisted, as a series of small contributions, rather than as one gigantic one-shot one.  Contributions over, say, 400 lines, take exponentially longer to review.
> 
> Sounds great, I'll prepare a GitHub PR. Unfortunately the first one will be ~2000 lines just to login and connect to a share, but after that each new packet-type will be small.
> 
> Regarding unit-tests, I've found the best way to test the server is to use reactor.spawnProcess to launch the Samba command-line client, but that requires smbclient be available to run tests.

You can feel free to edit the CI configuration to ensure that smbclient is installed in some of the environments to be sure it's tested.  (And these kinds of little details are good reasons to do this develop-in-Twisted strategy; easier to deal with the gnarly configuration issues early than to try to debug them once you have a big pile of code.)

However, tests like this are whole-system integration tests. While they're great, they also tend to be slow and flaky, particularly if you don't have other forms of testing.  You might want finer-grained unit tests, particularly to deal with error scenarios or boundary conditions which might be hard to provoke with a real client doing real I/O.  Were you thinking of writing an SMB client as well?  One way to write these finer-grained tests is to have the client and the server talk to each other.

It's been a long while since we had a major new subsystem.  I'm excited to see this stuff come in!

One minor note: you may want to do the initial development in an underscore-prefixed package, like twisted._fileserver or somesuch, so that we can separate out the discussion of "public API design" from the issues of code quality / test coverage / etc.

-glyph


More information about the Twisted-Python mailing list