diff options
author | Hans Nilsson <[email protected]> | 2019-01-07 15:45:39 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2019-01-07 15:45:39 +0100 |
commit | 22636c38163e0a5ceb4feb71f72c62679a590a78 (patch) | |
tree | ad85256be58a183cbf2c4c30b87ccf3ab71a4c88 /lib | |
parent | d8bbddd29dc2d30d8648ff6dd3006c5db0f6fd21 (diff) | |
parent | 330a1ffcb7ad9ba6700801492e160d4b923239ca (diff) | |
download | otp-22636c38163e0a5ceb4feb71f72c62679a590a78.tar.gz otp-22636c38163e0a5ceb4feb71f72c62679a590a78.tar.bz2 otp-22636c38163e0a5ceb4feb71f72c62679a590a78.zip |
Merge branch 'hans/ssh/cuddle_tests' into maint
* hans/ssh/cuddle_tests:
ssh: Wait a bit for the docker client to finnish in ssh_compat_SUITE
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ssh/test/ssh_compat_SUITE.erl | 18 |
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, |