Skip to content

Commit 1cdff0a

Browse files
authored
Merge pull request #1367 from yedayak/sshd-in-ci
Run sshd in CI
2 parents 2bedef0 + d935c01 commit 1cdff0a

File tree

8 files changed

+22
-2
lines changed

8 files changed

+22
-2
lines changed

.github/workflows/ci.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ jobs:
7171
--env BSD=${{matrix.bsd}}
7272
--env PYTESTFLAGS="--verbose -p no:cacheprovider"
7373
--env NETWORK=$NETWORK
74+
--env BASH_COMPLETION_TEST_LIVE_SSH_HOST=localhost
7475
${NETWORK:+--network $NETWORK}
7576
--volume $PWD:/usr/src/bash-completion
7677
--workdir /usr/src/bash-completion

test/docker/alpine/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ RUN apk add --no-cache \
99
musl-dev \
1010
py3-pexpect \
1111
py3-pytest-xdist \
12+
openssh-server \
1213
tar \
1314
xvfb \
1415
xvfb-run \

test/docker/centos7/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ RUN set -x \
1717
# /usr/bin/which: https://bugzilla.redhat.com/show_bug.cgi?id=1443357 \
1818
/usr/bin/which \
1919
/usr/bin/xvfb-run \
20+
openssh-server \
2021
python36-pexpect
2122

2223
ADD test-cmd-list.txt \

test/docker/debian10/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
77
autoconf \
88
automake \
99
make \
10+
openssh-server \
1011
python3-pexpect \
1112
python3-pytest-xdist \
1213
xvfb xauth \

test/docker/entrypoint.sh

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ oldpwd=$(pwd)
1313
cp -a . /work
1414
cd /work
1515

16+
# Dependencies for running sshd and connecting to it
17+
ssh-keygen -A
18+
mkdir -p ~/.ssh/ /var/run/sshd
19+
echo "localhost $(cat /etc/ssh/ssh_host_ed25519_key.pub)" >>~/.ssh/known_hosts
20+
ssh-keygen -t ed25519 -N '' -f "$HOME/.ssh/id_ed25519"
21+
cat "$HOME/.ssh/id_ed25519.pub" >>"$HOME/.ssh/authorized_keys"
22+
23+
# sshd forces you to run with the full path
24+
sshpath="$(command -v sshd)"
25+
$sshpath
26+
1627
autoreconf -i
1728
./configure
1829
make -j

test/docker/fedoradev/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ RUN echo install_weak_deps=False >> /etc/dnf/dnf.conf \
99
/usr/bin/make \
1010
/usr/bin/xvfb-run \
1111
/usr/bin/pytest-3 \
12+
openssh-server \
1213
python3-pexpect \
1314
python3-pytest-xdist \
1415
&& ln -s $(type -P pytest-3) /usr/local/bin/pytest

test/docker/ubuntu14/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
88
automake \
99
make \
1010
software-properties-common \
11+
openssh-server \
1112
xvfb \
1213
&& python3.4 -c "import urllib.request; urllib.request.urlretrieve('https://github.com/pyston/pyston/releases/download/pyston_2.3.1/pyston_2.3.1_portable_v2.tar.gz', '/tmp/pyston.tar.gz')" \
1314
&& tar xCf /usr/local /tmp/pyston.tar.gz --strip-components=1

test/t/test_scp.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
import os
12
from itertools import chain
23

34
import pytest
45

56
from conftest import assert_bash_exec, assert_complete, bash_env_saved
67

7-
LIVE_HOST = "bash_completion"
8+
LIVE_HOST = os.environ.get(
9+
"BASH_COMPLETION_TEST_LIVE_SSH_HOST", default="bash_completion"
10+
)
811

912

1013
class TestScp:
@@ -76,7 +79,7 @@ def test_live(self, live_pwd, completion):
7679
Connection to it must open sufficiently quickly for the
7780
ConnectTimeout and sleep_after_tab settings.
7881
"""
79-
assert completion == f"{LIVE_HOST}:{live_pwd}/"
82+
assert completion == f"{live_pwd}/"
8083

8184
@pytest.mark.complete("scp -o Foo=")
8285
def test_option_arg(self, completion):

0 commit comments

Comments
 (0)