Comments (6)
Can you please show me such a test. I would like to understand better the problem that should be solved. You can remove details of the test and replace it with comments of course.
from fake-sftp-server-lambda.
Very short and without code it looks something like this:
// Setup
// Call to unrelated service
// Start fake-sftp-server
// Call(s) to service that needs to use SFTP
// Get file A from the server
// Verify file
// Get file B from the server
// Verify file
...
// If files passed verification upload response
// Verify that service transformed the file correctly
...
I know there are a couple of things that I can do myself to make this big withSftpServer smaller. Like moving the last if block to a separate withSftpServer but it doesn't sit well with me to essentially use two ftp servers when in reality it's the same server. Or breaking out the verification but that breaks how we generally structure our tests in the code base with verifying as we go instead of doing it "in batches". But even if I did do these refactoring it would still be a a couple of rows wrapped inside the call to setup the fake ftp server thus the reason I would like to control the start and stop of the sftp server myself.
from fake-sftp-server-lambda.
Forgot to mention but it also creates a lot of extra bulk having to set up new users, ports and directories everywhere when generally it's the same for all tests
from fake-sftp-server-lambda.
Let me rephrase what I understood. From your point of view there are too issues with using Fake SFTP Server Lambda.
- Most of your test methods have an additional level of indent because the code is within a lambda expression like
@Test
void someTest() {
withSftpServer(server -> {
... // a lot of lines with your test code
});
}
- You have the same setup code in every method
@Test
void someTest() {
//common setup code that is repeated in every test
withSftpServer(server -> {
...
});
}
Is that correct?
from fake-sftp-server-lambda.
Correct but as I added in the comment just above I also have to set up users, ports, folder et.c constantly even though they rarely differs between the tests that needs to use SFTP.
from fake-sftp-server-lambda.
+1 for this.
We use this library in scala and it makes our tests very big and less readable, we would like to have a single instance of the fake server for the whole tests in a file, like this:
val server = new FakeSftpServer()
override def beforeAllTests() {
server.start
server.putFile(.....)
server.putFile(.....)
}
override def afterAllTests() {
server.stop
}
The problem is that FakeSftpServer needs memory filesystem as constructor (have to add a dependency to marschall.memoryfilesystem) and server.start is private.
from fake-sftp-server-lambda.
Related Issues (9)
- It gives Auth fail when try to connect via jsch HOT 2
- Apache sshd-sftp:2.9.0 breaks the server
- Get the list of existing files
- use stable library versions HOT 2
- Unable to start SFTP Server on ubuntu HOT 2
- AbstractMethodError: missing implementation of createFileSystem HOT 1
- Doesn't work with sshd-sftp 2.5 HOT 4
- Tests fails only on github actions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fake-sftp-server-lambda.