Skip to content

Commit c518b3d

Browse files
committed
Use second as timetout setting instead of milli second
1 parent 584ae3c commit c518b3d

File tree

2 files changed

+1
-39
lines changed

2 files changed

+1
-39
lines changed

src/main/java/org/embulk/output/sftp/SftpFileOutput.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private FileSystemOptions initializeFsOptions(PluginTask task)
8383
try {
8484
SftpFileSystemConfigBuilder builder = SftpFileSystemConfigBuilder.getInstance();
8585
builder.setUserDirIsRoot(fsOptions, task.getUserDirIsRoot());
86-
builder.setTimeout(fsOptions, task.getSftpConnectionTimeout());
86+
builder.setTimeout(fsOptions, task.getSftpConnectionTimeout() * 1000);
8787
builder.setStrictHostKeyChecking(fsOptions, "no");
8888
if (task.getSecretKeyFilePath().isPresent()) {
8989
IdentityInfo identityInfo = new IdentityInfo(

src/test/java/org/embulk/output/sftp/TestSftpFileOutputPlugin.java

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import com.google.common.base.Optional;
55
import com.google.common.collect.Lists;
66
import com.google.common.io.Resources;
7-
import org.apache.commons.vfs2.FileSystemException;
87
import org.apache.sshd.common.NamedFactory;
98
import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
109
import org.apache.sshd.server.Command;
@@ -30,7 +29,6 @@
3029
import org.embulk.spi.Schema;
3130
import org.embulk.spi.TransactionalPageOutput;
3231
import org.embulk.spi.time.Timestamp;
33-
import org.hamcrest.CoreMatchers;
3432
import org.junit.After;
3533
import org.junit.Before;
3634
import org.junit.Rule;
@@ -474,42 +472,6 @@ public void testUserSecretKeyFileWithProxy()
474472
}
475473
}
476474

477-
@Test
478-
public void testTimeout()
479-
{
480-
// setting embulk config
481-
final String pathPrefix = "/test/testUserPassword";
482-
String configYaml = "" +
483-
"type: sftp\n" +
484-
"host: " + HOST + "\n" +
485-
"port: " + PORT + "\n" +
486-
"user: " + USERNAME + "\n" +
487-
"secret_key_file: " + SECRET_KEY_FILE + "\n" +
488-
"secret_key_passphrase: " + SECRET_KEY_PASSPHRASE + "\n" +
489-
"path_prefix: " + testFolder.getRoot().getAbsolutePath() + pathPrefix + "\n" +
490-
"timeout: 1\n" +
491-
"file_ext: txt\n" +
492-
"formatter:\n" +
493-
" type: csv\n" +
494-
" newline: CRLF\n" +
495-
" newline_in_field: LF\n" +
496-
" header_line: true\n" +
497-
" charset: UTF-8\n" +
498-
" quote_policy: NONE\n" +
499-
" quote: \"\\\"\"\n" +
500-
" escape: \"\\\\\"\n" +
501-
" null_string: \"\"\n" +
502-
" default_timezone: 'UTC'";
503-
504-
// exception
505-
exception.expect(RuntimeException.class);
506-
exception.expectCause(CoreMatchers.<Throwable>instanceOf(FileSystemException.class));
507-
exception.expectMessage("Could not connect to SFTP server");
508-
509-
// runner.transaction -> ...
510-
run(configYaml, Optional.of(60)); // sleep 1 minute while processing
511-
}
512-
513475
@Test
514476
public void testProxyType()
515477
{

0 commit comments

Comments
 (0)