yanne / api-test

0 stars 0 forks source link

New keywords for checking if a file or a directory (not) exists on the remote host #74

Closed yanne closed 10 years ago

yanne commented 10 years ago

The SSHLibrary should have keywords File Should Exist, File Should Not Exists, Directory Should Exist and Directory Should Not Exist checking if a file or a directory exists on the remote.

Currently something similar to this:

${rc} = Execute Command test -f /path/to/the/file Should Be Equal As Integers ${rc} 0

is required to achieve this, which is not very cross-platform friendly. Also, checking the existence is a quite common use case.

These keywords should work similarly as the corresponding ones in the OperatingSystem test library (i.e. they should follow symlinks), except supporting pattern matching (using wildcards) is not likely necessary. Please comment on this, if this is behaviour required.

This issue was originally opened at Google Code on Aug 21, 2013.

yanne commented 10 years ago

Original comment by anssi.sy...@eficode.com on Aug 21, 2013.

This is done by https://code.google.com/p/robotframework-sshlibrary/source/detail?r=9f6ec38468406faa1a5196ffa0d7dc129cf68556

yanne commented 10 years ago

Original comment by pekka.klarck on Oct 30, 2013.

Review comments:

yanne commented 10 years ago

Original comment by anssi.sy...@eficode.com on Nov 5, 2013.

This issue was updated by revision 30a2b2b58ef1 .

Some of the tests for this functionality were invalid. Fixed those.

yanne commented 10 years ago

Original comment by anssi.sy...@eficode.com on Nov 11, 2013.

This issue was updated by revision 30a2b2b58ef1 .

Some of the tests for this functionality were invalid. Fixed those.

yanne commented 10 years ago

Original comment by piliszekm on Nov 14, 2013.

If file does not exist File Should Exist is not failing.

yanne commented 10 years ago

Original comment by piliszekm on Nov 14, 2013.

checked on AIX box.

yanne commented 10 years ago

Original comment by anssi.sy...@eficode.com on Nov 18, 2013.

This issue was updated by revision bef8277ab778 .

Keyword did not assert which triggered no errors for the existing files or directories. This should be now fixed.

Also some test refactoring was done related to the changes.

yanne commented 10 years ago

Original comment by piliszekm on Nov 20, 2013.

Issues with encoding - my favourite ones.

Test: * Settings * Library SSHLibrary WITH NAME ssh

* Test Cases * test ${IP} Set Variable .... ${USER} Set Variable .... ${PASS} Set Variable ... ${PROMPT} Set Variable .... ${ENCODING} Set Variable iso-8859-2 Open Connection ${IP} prompt=${PROMPT} encoding=${ENCODING} timeout=20 Login ${USER} ${PASS} Write export PS1="testprompt$" Set Client Configuration prompt=testprompt$ encoding=${ENCODING} Read Until Prompt Sleep 1s Read Write ls /tmp/test* Read Until Prompt File Should Exist /tmp/test.txt File Should Exist /tmp/testä.txt File Should Exist /tmp/blablabla.txt

Console output: ... 20131120 12:05:45.428 : INFO : 1: export PS1="testprompt$ 20131120 12:05:46.430 : INFO : Slept 1 second 20131120 12:05:46.432 : INFO : " testprompt$ 20131120 12:05:46.560 : INFO : ls /tmp/test* 20131120 12:05:46.562 : INFO : /tmp/test.txt /tmp/testä.txt testprompt$ 20131120 12:05:46.929 : INFO : [chan 2] Opened sftp connection (server version 3) 20131120 12:05:47.304 : FAIL : File '/tmp/testä.txt' does not exist.

yanne commented 10 years ago

Original comment by anssi.sy...@eficode.com on Nov 20, 2013.

Yes, this is closely related to issue 60 , and will be fixed as part of that. Thanks again for the heads-up!

yanne commented 10 years ago

Original comment by anssi.sy...@eficode.com on Nov 25, 2013.

The encoding should be now handled correctly for these keywords as well. This was done as part of issue 60 (by revision b890cb86655d and revision d2e42d5ff95c ).