mirror of
https://github.com/google/cdc-file-transfer.git
synced 2026-09-13 01:10:44 +03:00
[cdc_rsync] [cdc_stream] Remove SSH port argument (#41)
This CL removes the port arguments for both tools. The port argument can also be specified via the ssh-command and scp-command flags. In fact, if a port is specified by both port flags and ssh/scp commands, they interfere with each other. For ssh, the one specified in ssh-command wins. For scp, the one specified in scp-command wins. To fix this, one would have to parse scp-command and remove the port arg there. Or we could just remove the ssh-port arg. This is what this CL does. Note that if you need a custom port, it's very likely that you also have to define custom ssh and scp commands.
This commit is contained in:
@@ -97,7 +97,6 @@ class ParamsTest : public ::testing::Test {
|
||||
TEST_F(ParamsTest, ParseSucceedsDefaults) {
|
||||
const char* argv[] = {"cdc_rsync.exe", kSrc, kUserHostDst, NULL};
|
||||
EXPECT_TRUE(Parse(static_cast<int>(std::size(argv)) - 1, argv, ¶meters_));
|
||||
EXPECT_EQ(RemoteUtil::kDefaultSshPort, parameters_.options.port);
|
||||
EXPECT_FALSE(parameters_.options.delete_);
|
||||
EXPECT_FALSE(parameters_.options.recursive);
|
||||
EXPECT_EQ(0, parameters_.options.verbosity);
|
||||
@@ -145,13 +144,6 @@ TEST_F(ParamsTest, ParseFailsOnCompressLevelEqualsNoValue) {
|
||||
ExpectError(NeedsValueError("compress-level"));
|
||||
}
|
||||
|
||||
TEST_F(ParamsTest, ParseFailsOnPortEqualsNoValue) {
|
||||
const char* argv[] = {"cdc_rsync.exe", "--port=", kSrc, kUserHostDst, NULL};
|
||||
EXPECT_FALSE(
|
||||
Parse(static_cast<int>(std::size(argv)) - 1, argv, ¶meters_));
|
||||
ExpectError(NeedsValueError("port"));
|
||||
}
|
||||
|
||||
TEST_F(ParamsTest, ParseFailsOnContimeoutEqualsNoValue) {
|
||||
const char* argv[] = {"cdc_rsync.exe", "--contimeout=", kSrc, kUserHostDst,
|
||||
NULL};
|
||||
@@ -285,13 +277,18 @@ TEST_F(ParamsTest, ParseFailsOnUnknownKey) {
|
||||
}
|
||||
|
||||
TEST_F(ParamsTest, ParseSucceedsWithSupportedKeyValue) {
|
||||
const char* argv[] = {
|
||||
"cdc_rsync.exe", "--compress-level", "11", "--contimeout", "99", "--port",
|
||||
"4086", "--copy-dest=dest", kSrc, kUserHostDst, NULL};
|
||||
const char* argv[] = {"cdc_rsync.exe",
|
||||
"--compress-level",
|
||||
"11",
|
||||
"--contimeout",
|
||||
"99",
|
||||
"--copy-dest=dest",
|
||||
kSrc,
|
||||
kUserHostDst,
|
||||
NULL};
|
||||
EXPECT_TRUE(Parse(static_cast<int>(std::size(argv)) - 1, argv, ¶meters_));
|
||||
EXPECT_EQ(parameters_.options.compress_level, 11);
|
||||
EXPECT_EQ(parameters_.options.connection_timeout_sec, 99);
|
||||
EXPECT_EQ(parameters_.options.port, 4086);
|
||||
EXPECT_EQ(parameters_.options.copy_dest, "dest");
|
||||
ExpectNoError();
|
||||
}
|
||||
@@ -304,13 +301,6 @@ TEST_F(ParamsTest, ParseSucceedsWithSupportedKeyValueWithoutEqualityForChars) {
|
||||
ExpectNoError();
|
||||
}
|
||||
|
||||
TEST_F(ParamsTest, ParseFailsOnInvalidPort) {
|
||||
const char* argv[] = {"cdc_rsync.exe", "--port=0", kSrc, kUserHostDst, NULL};
|
||||
EXPECT_FALSE(
|
||||
Parse(static_cast<int>(std::size(argv)) - 1, argv, ¶meters_));
|
||||
ExpectError("--port must specify a valid port");
|
||||
}
|
||||
|
||||
TEST_F(ParamsTest, ParseFailsOnDeleteNeedsRecursive) {
|
||||
const char* argv[] = {"cdc_rsync.exe", "--delete", kSrc, kUserHostDst, NULL};
|
||||
EXPECT_FALSE(
|
||||
|
||||
Reference in New Issue
Block a user