aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2019-01-07 15:46:00 +0100
committerHans Nilsson <[email protected]>2019-01-07 15:46:00 +0100
commit753a9e62bd100c9a81f484a5af3512888f9e093d (patch)
tree1aeeaac491333b3852daf743157c6b6be6c04264 /lib/ssh
parenta0360c361e7965f0cc3badfb61d04f48ddc69dc5 (diff)
parent22636c38163e0a5ceb4feb71f72c62679a590a78 (diff)
downloadotp-753a9e62bd100c9a81f484a5af3512888f9e093d.tar.gz
otp-753a9e62bd100c9a81f484a5af3512888f9e093d.tar.bz2
otp-753a9e62bd100c9a81f484a5af3512888f9e093d.zip
Merge branch 'maint'
* maint: ssh: Wait a bit for the docker client to finnish in ssh_compat_SUITE
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/test/ssh_compat_SUITE.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/ssh/test/ssh_compat_SUITE.erl b/lib/ssh/test/ssh_compat_SUITE.erl
index f4eef2dc77..8e82527c6e 100644
--- a/lib/ssh/test/ssh_compat_SUITE.erl
+++ b/lib/ssh/test/ssh_compat_SUITE.erl
@@ -1126,7 +1126,24 @@ prepare_local_directory(ServerRootDir) ->
"chmod 222 unreadable_file",
"exit"].
+
check_local_directory(ServerRootDir) ->
+ TimesToTry = 3, % sleep 0.5, 1, 2 and then 4 secs (7.5s in total)
+ check_local_directory(ServerRootDir, 500, TimesToTry-1).
+
+check_local_directory(ServerRootDir, SleepTime, N) ->
+ case do_check_local_directory(ServerRootDir) of
+ {error,Error} when N>0 ->
+ %% Could be that the erlang side is faster and the docker's operations
+ %% are not yet finalized.
+ %% Sleep for a while and retry a few times:
+ timer:sleep(SleepTime),
+ check_local_directory(ServerRootDir, 2*SleepTime, N-1);
+ Other ->
+ Other
+ end.
+
+do_check_local_directory(ServerRootDir) ->
case lists:sort(ok(file:list_dir(ServerRootDir)) -- [".",".."]) of
["ex_tst1","mydir","tst2"] ->
{ok,Expect} = file:read_file(filename:join(ServerRootDir,"ex_tst1")),
@@ -1161,6 +1178,7 @@ check_local_directory(ServerRootDir) ->
{error,{bad_dir_contents,"/"}}
end.
+
call_sftp_in_docker(Config, ServerIP, ServerPort, Cmnds, UserDir) ->
{DockerIP,DockerPort} = ip_port(Config),
{ok,C} = ssh:connect(DockerIP, DockerPort,