From 5cac2380e5d206fa16776360725c5c5c200ca7dd Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Thu, 17 Jul 2014 22:16:46 +0200 Subject: [PATCH] Do not use (buggy) docker provisioner --- test/Dockerfile | 29 -------------------------- test/Vagrantfile | 13 ++++-------- test/docker_ssh.key | 27 ------------------------ test/tests/test_helpers.sh | 11 ++++++---- test/tests/test_plugin_installation.sh | 8 +++---- test/tests/test_plugin_sourcing.sh | 5 ++--- test/vagrant_provisioning.sh | 9 ++++++++ 7 files changed, 26 insertions(+), 76 deletions(-) delete mode 100644 test/Dockerfile delete mode 100644 test/docker_ssh.key create mode 100644 test/vagrant_provisioning.sh diff --git a/test/Dockerfile b/test/Dockerfile deleted file mode 100644 index beb95f2..0000000 --- a/test/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -# Tmux -# -# VERSION 0.0.1 - -FROM ubuntu:trusty - -MAINTAINER Bruno Sutic "bruno.sutic@gmail.com" - -RUN apt-get update - -RUN apt-get install -y git-core -RUN apt-get install -y expect -RUN apt-get install -y python-software-properties software-properties-common - -# sshd -RUN apt-get install -y openssh-server -RUN mkdir /var/run/sshd - -# Enabling passwordless ssh login with `docker_ssh.key` private key. -RUN mkdir -p /root/.ssh/ -RUN echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVmzBG5v7cO9IScGLIzlhGlHNFhXzy87VfaPzru7qnIIdQ1e9FEKvtqEws8hVixnCUdviwX5lvcMk4Ef4Tbrmj3dyF0zFtYbjiTSyl/XQlF68DQlc2sTAdHy96wJHvh7ky511tKJzzyWwSqeef4WjeVK28TqcGnq1up0S7saFO0dJh6OfDAg2cDmhyweR3VgT0vZJyrDV7hte95MBCdK+Gp7fdCyEZcWm3S1DBFaeBqHzzt/Y/njAVKbYL9TIVPum8iMg0rMiLi9ShfP+dT5Xud5Oa3dcN2OWhiDfJw5pfhFJWd44cJ/uGRwQpvNs/PNKsYABhgLlTMUH4iawhu1Xb' > /root/.ssh/authorized_keys - -# install latest Tmux 1.9a -RUN add-apt-repository ppa:pi-rho/dev -RUN apt-get update -RUN apt-get install -y tmux=1.9a-1~ppa1~t - -EXPOSE 22 -CMD /usr/sbin/sshd -D diff --git a/test/Vagrantfile b/test/Vagrantfile index 868abbf..1229510 100644 --- a/test/Vagrantfile +++ b/test/Vagrantfile @@ -1,16 +1,11 @@ -Vagrant.require_version '>= 1.6.0' - VAGRANTFILE_API_VERSION = '2' Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - config.vm.provider 'docker' do |d| - d.build_dir = '.' - d.has_ssh = true - end + config.vm.box = 'precise32' + config.vm.box_url = 'http://files.vagrantup.com/precise32.box' # tpm is synced to `/root/tmux_plugin_manager` in vagrant - config.vm.synced_folder '../', '/root/tmux_plugin_manager' + config.vm.synced_folder '../', '/home/vagrant/tpm' - config.ssh.username = 'root' - config.ssh.private_key_path = 'docker_ssh.key' + config.vm.provision 'shell', path: 'vagrant_provisioning.sh' end diff --git a/test/docker_ssh.key b/test/docker_ssh.key deleted file mode 100644 index 36498f6..0000000 --- a/test/docker_ssh.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEA1ZswRub+3DvSEnBiyM5YRpRzRYV88vO1X2j867u6pyCHUNXv -RRCr7ahMLPIVYsZwlHb4sF+Zb3DJOBH+E265o93chdMxbWG44k0spf10JRevA0JX -NrEwHR8vesCR74e5MuddbSic88lsEqnnn+Fo3lStvE6nBp6tbqdEu7GhTtHSYejn -wwINnA5ocsHkd1YE9L2Scqw1e4bXveTAQnSvhqe33QshGXFpt0tQwRWngah887f2 -P54wFSm2C/UyFT7pvIjINKzIi4vUoXz/nU+V7neTmt3XDdjloYg3ycOaX4RSVneO -HCf7hkcEKbzbPzzSrGAAYYC5UzFB+ImsIbtV2wIDAQABAoIBAQCjROxgtX2Gft7y -Ix8Ol9IXmK6HLCI2XZt7ovb3hFWGGzHy0qMBql2P2Tzoed1o038Hq+woe9n+uTn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kwam54JCjiV+3TZbSyRMOjkqf7UhTCZC6hHNqdUnlpv4bJWeW -i5Eun8ltYxBnemNc2QGxA4r+KCspi+pRvWNGzL3PFVBGXiLsmOMul78= ------END RSA PRIVATE KEY----- diff --git a/test/tests/test_helpers.sh b/test/tests/test_helpers.sh index a5f7b97..6ac67a2 100644 --- a/test/tests/test_helpers.sh +++ b/test/tests/test_helpers.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -export TEST_FAIL=false +FAIL="false" set_tmux_conf_helper() { > ~/.tmux.conf # empty filename @@ -35,12 +35,15 @@ check_dir_exists_helper() { fi } -fail_test() { - TEST_FAIL=true +fail_helper() { + local message="$1" + echo "Tmux plugin installation fails" >&2 + FAIL="true" } exit_value_helper() { - if $TEST_FAIL; then + local fail="$1" + if [ "$FAIL" == "true" ]; then echo echo "Test failed" exit 1 diff --git a/test/tests/test_plugin_installation.sh b/test/tests/test_plugin_installation.sh index 7594417..da11548 100755 --- a/test/tests/test_plugin_installation.sh +++ b/test/tests/test_plugin_installation.sh @@ -7,16 +7,16 @@ source $CURRENT_DIR/test_helpers.sh test_plugin_installation() { set_tmux_conf_helper <<- HERE set -g @tpm_plugins "bruno-/tmux_example_plugin" - run-shell '/root/tmux_plugin_manager/tpm' + run-shell "~/tpm/tpm" HERE # opens tmux and test it with `expect` $CURRENT_DIR/expect_successful_plugin_download || - (echo "Tmux plugin installation fails" >&2; fail_test) + fail_helper "Tmux plugin installation fails" # check plugin dir exists after download - check_dir_exists_helper "/root/.tmux/plugins/tmux_example_plugin/" || - (echo "Plugin download fails" >&2; fail_test) + check_dir_exists_helper "$HOME/.tmux/plugins/tmux_example_plugin/" || + fail_helper "Plugin download fails" teardown_helper } diff --git a/test/tests/test_plugin_sourcing.sh b/test/tests/test_plugin_sourcing.sh index a63146a..fee32a3 100755 --- a/test/tests/test_plugin_sourcing.sh +++ b/test/tests/test_plugin_sourcing.sh @@ -12,8 +12,7 @@ check_binding_defined() { test_plugin_sourcing() { set_tmux_conf_helper <<- HERE set -g @tpm_plugins "doesnt_matter/tmux_test_plugin" - # change this - run-shell '/root/tmux_plugin_manager/tpm' + run-shell "~/tpm/tpm" HERE # manually creates a local tmux plugin @@ -23,7 +22,7 @@ test_plugin_sourcing() { tmux new-session -d # tmux starts detached check_binding_defined "R run-shell foo_command" || - (echo "Plugin sourcing fails" >&2; fail_test) + fail_helper "Plugin sourcing fails" teardown_helper } diff --git a/test/vagrant_provisioning.sh b/test/vagrant_provisioning.sh new file mode 100644 index 0000000..aff44a9 --- /dev/null +++ b/test/vagrant_provisioning.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +sudo apt-get update +sudo apt-get install -y git-core expect python-software-properties software-properties-common + +# install latest Tmux 1.9a +sudo add-apt-repository -y ppa:pi-rho/dev +sudo apt-get update +sudo apt-get install -y tmux=1.9a-1~ppa1~p