Skip to content

Commit

Permalink
tests: remove real SSH (#4200)
Browse files Browse the repository at this point in the history
* tests: remove real SSH

No longer needed, all tests are using mocked ssh already.

* travis: don't setup ssh
  • Loading branch information
efiop authored Jul 14, 2020
1 parent c4b2f68 commit 4c9245a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 44 deletions.
15 changes: 0 additions & 15 deletions scripts/ci/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,6 @@ fi
echo >env.sh

if [[ "$TRAVIS_BUILD_STAGE_NAME" == "test" ]]; then
if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then
# NOTE: ssh keys for ssh test to be able to ssh to the localhost
ssh-keygen -t rsa -N "" -f mykey
mkdir -p ~/.ssh
cp mykey ~/.ssh/id_rsa
cp mykey.pub ~/.ssh/id_rsa.pub
cat mykey.pub >>~/.ssh/authorized_keys
ssh-keyscan localhost >>~/.ssh/known_hosts
ssh localhost ls &>/dev/null
ssh-keyscan 127.0.0.1 >>~/.ssh/known_hosts
ssh 127.0.0.1 ls &>/dev/null
ssh-keyscan 0.0.0.0 >>~/.ssh/known_hosts
ssh 0.0.0.0 ls &>/dev/null
fi

if [[ "$TRAVIS_OS_NAME" == "osx" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then
brew install openssl
$scriptdir/retry.sh brew cask install google-cloud-sdk
Expand Down
1 change: 0 additions & 1 deletion tests/remotes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
gs,
)
from .ssh import ( # noqa: F401; noqa: F401
SSH,
SSHMocked,
ssh,
ssh_connection,
Expand Down
28 changes: 0 additions & 28 deletions tests/remotes/ssh.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import getpass
import locale
import os
from contextlib import contextmanager
from subprocess import CalledProcessError, check_output

import pytest
from funcy import cached_property

from dvc.path_info import URLInfo
from dvc.utils import env2bool

from .base import Base
from .local import Local
Expand All @@ -19,31 +16,6 @@
)


class SSH:
@staticmethod
def should_test():
do_test = env2bool("DVC_TEST_SSH", undefined=None)
if do_test is not None:
return do_test

# FIXME: enable on windows
if os.name == "nt":
return False

try:
check_output(["ssh", "-o", "BatchMode=yes", "127.0.0.1", "ls"])
except (CalledProcessError, OSError):
return False

return True

@staticmethod
def get_url():
return "ssh://{}@127.0.0.1:22{}".format(
getpass.getuser(), Local.get_storagepath()
)


class SSHMocked(Base, URLInfo):
@staticmethod
def get_url(user, port): # pylint: disable=arguments-differ
Expand Down

0 comments on commit 4c9245a

Please sign in to comment.