Patchwork [STABLE] test: add a test file that displays ssh behavior in front of various errors

login
register
mail settings
Submitter Boris Feld
Date Aug. 14, 2018, 9:54 a.m.
Message ID <6023a2e72ff5a094430c.1534240451@FB-lair>
Download mbox | patch
Permalink /patch/33713/
State New
Headers show

Comments

Boris Feld - Aug. 14, 2018, 9:54 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1533106375 -7200
#      Wed Aug 01 08:52:55 2018 +0200
# Branch stable
# Node ID 6023a2e72ff5a094430c5f0704fb161883133609
# Parent  fe3ca1e6f786c1ea8eadf8cff9057095dbb2d463
# EXP-Topic ssh-error
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 6023a2e72ff5
test: add a test file that displays ssh behavior in front of various errors

These errors are suboptimal since they claim the repository is missing while
it is permission issues.
Boris Feld - Aug. 14, 2018, 11:47 a.m.
This one is a misfire, please ignore it


On 14/08/2018 11:54, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1533106375 -7200
> #      Wed Aug 01 08:52:55 2018 +0200
> # Branch stable
> # Node ID 6023a2e72ff5a094430c5f0704fb161883133609
> # Parent  fe3ca1e6f786c1ea8eadf8cff9057095dbb2d463
> # EXP-Topic ssh-error
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 6023a2e72ff5
> test: add a test file that displays ssh behavior in front of various errors
>
> These errors are suboptimal since they claim the repository is missing while
> it is permission issues.
>
> diff --git a/tests/test-ssh-repoerror.t b/tests/test-ssh-repoerror.t
> new file mode 100644
> --- /dev/null
> +++ b/tests/test-ssh-repoerror.t
> @@ -0,0 +1,70 @@
> +
> +initial setup
> +
> +  $ cat << EOF >> $HGRCPATH
> +  > [ui]
> +  > ssh=$PYTHON "$TESTDIR/dummyssh"
> +  > EOF
> +
> +
> +repository itself is non-readable
> +---------------------------------
> +
> +  $ hg init no-read
> +  $ hg id ssh://user@dummy/no-read
> +  000000000000
> +  $ chmod a-rx no-read
> +
> +  $ hg id ssh://user@dummy/no-read
> +  remote: abort: repository no-read not found!
> +  abort: no suitable response from remote hg!
> +  [255]
> +
> +special case files are visible, but unreadable
> +----------------------------------------------
> +
> +This is "similar" to the test above, but the directory is "traversable". This
> +seems an unexpected case in real life, but we test it anyway.
> +
> +  $ hg init other
> +  $ hg id ssh://user@dummy/other
> +  000000000000
> +  $ for item in `find other | sort -r` ; do
> +  >     chmod a-r $item
> +  > done
> +
> +  $ hg id ssh://user@dummy/other
> +  remote: abort: Permission denied: $TESTTMP/other/.hg/requires
> +  abort: no suitable response from remote hg!
> +  [255]
> +
> +directory toward the repository is read only
> +--------------------------------------------
> +
> +  $ mkdir deep
> +  $ hg init deep/nested
> +
> +  $ hg id ssh://user@dummy/deep/nested
> +  000000000000
> +
> +  $ chmod a-rx deep
> +
> +  $ hg id ssh://user@dummy/deep/nested
> +  remote: abort: repository deep/nested not found!
> +  abort: no suitable response from remote hg!
> +  [255]
> +
> +repository has wrong requirement
> +--------------------------------
> +
> +  $ hg init repo-future
> +  $ hg id ssh://user@dummy/repo-future
> +  000000000000
> +  $ echo flying-car >> repo-future/.hg/requires
> +  $ hg id ssh://user@dummy/repo-future
> +  remote: abort: repository requires features unknown to this Mercurial: flying-car!
> +  remote: (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
> +  abort: no suitable response from remote hg!
> +  [255]
> +
> +
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/tests/test-ssh-repoerror.t b/tests/test-ssh-repoerror.t
new file mode 100644
--- /dev/null
+++ b/tests/test-ssh-repoerror.t
@@ -0,0 +1,70 @@ 
+
+initial setup
+
+  $ cat << EOF >> $HGRCPATH
+  > [ui]
+  > ssh=$PYTHON "$TESTDIR/dummyssh"
+  > EOF
+
+
+repository itself is non-readable
+---------------------------------
+
+  $ hg init no-read
+  $ hg id ssh://user@dummy/no-read
+  000000000000
+  $ chmod a-rx no-read
+
+  $ hg id ssh://user@dummy/no-read
+  remote: abort: repository no-read not found!
+  abort: no suitable response from remote hg!
+  [255]
+
+special case files are visible, but unreadable
+----------------------------------------------
+
+This is "similar" to the test above, but the directory is "traversable". This
+seems an unexpected case in real life, but we test it anyway.
+
+  $ hg init other
+  $ hg id ssh://user@dummy/other
+  000000000000
+  $ for item in `find other | sort -r` ; do
+  >     chmod a-r $item
+  > done
+
+  $ hg id ssh://user@dummy/other
+  remote: abort: Permission denied: $TESTTMP/other/.hg/requires
+  abort: no suitable response from remote hg!
+  [255]
+
+directory toward the repository is read only
+--------------------------------------------
+
+  $ mkdir deep
+  $ hg init deep/nested
+
+  $ hg id ssh://user@dummy/deep/nested
+  000000000000
+
+  $ chmod a-rx deep
+
+  $ hg id ssh://user@dummy/deep/nested
+  remote: abort: repository deep/nested not found!
+  abort: no suitable response from remote hg!
+  [255]
+
+repository has wrong requirement
+--------------------------------
+
+  $ hg init repo-future
+  $ hg id ssh://user@dummy/repo-future
+  000000000000
+  $ echo flying-car >> repo-future/.hg/requires
+  $ hg id ssh://user@dummy/repo-future
+  remote: abort: repository requires features unknown to this Mercurial: flying-car!
+  remote: (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
+  abort: no suitable response from remote hg!
+  [255]
+
+