diff --git a/README.adoc b/README.adoc index c87a3fb..c47752c 100644 --- a/README.adoc +++ b/README.adoc @@ -290,12 +290,6 @@ test and install this plugin on your local machine: # Install development dependencies $ gem install bundler && bundle install -# List available Rake tasks -$ bundle exec rake -T - -# Run Cucumber tests -$ bundle exec rake featuretests - # Build the gem (gets generated in the 'pkg' directory $ bundle exec rake build diff --git a/RELEASE.txt b/RELEASE.txt index 6a0c0c2..5621b97 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -1,8 +1,8 @@ +# point local system to git for vagrant-sshfs -# Run viv tests -cd /guests/sharedfolder/code/github.com/dustymabe/vagrant-sshfs/test/libvirt -vagrant up +# Run misc tests +cd /guests/sharedfolder/code/github.com/dustymabe/vagrant-sshfs/test/misc follow README for running tests # Make sure to bump version in lib/vagrant-sshfs/version.rb and commit @@ -36,8 +36,8 @@ verify with git verify-tag v1.2.0 git push git push --tags -# Build with bundle exec rake build (inside viv VM) -bundle exec rake build +# Build with build.sh script (uses buildah) +./bundle.sh # Sign the output gpg --armor --detach-sign pkg/vagrant-sshfs-1.2.0.gem diff --git a/Rakefile b/Rakefile index b447171..dc5c795 100644 --- a/Rakefile +++ b/Rakefile @@ -29,10 +29,3 @@ CLOBBER.include('pkg') task :init do FileUtils.mkdir_p 'build' end - -# Create new Cucumber::Rake::Task that will run Cucumber tests -Cucumber::Rake::Task.new(:featuretests) - -# Define Rake::Task dependency - run :init before :featuretests -task :featuretests => :init - diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..71142e5 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,27 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : +Vagrant.configure(2) do |config| + + config.ssh.insert_key = 'true' + config.vm.synced_folder "/guests/sharedfolder", "/sharedfolder", type: "sshfs" + + config.vm.provider :libvirt do |domain| + domain.memory = 4096 + domain.cpus = 4 + domain.nested = true + end + + host = 'vagrant-sshfs-builder' + box = 'fedora/28-cloud-base' + + config.vm.define host do | tmp | + tmp.vm.hostname = host + tmp.vm.box = box + end + config.vm.provision "shell", inline: <<-SHELL + dnf update -y + dnf install -y buildah + cd /sharedfolder/code/github.com/dustymabe/vagrant-sshfs + ./build.sh + SHELL +end diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..9dbad98 --- /dev/null +++ b/build.sh @@ -0,0 +1,48 @@ +#!/bin/bash -x +set -ex + +ctr=$(buildah from registry.fedoraproject.org/fedora:28) + +rpms=( + make gcc ruby ruby-devel redhat-rpm-config # for building gems + gcc-c++ # for building unf_ext + libvirt-devel # for building ruby-libvirt gem + zlib-devel # for building nokogiri gem + git # for the git ls-files in gemspec file + bsdtar # used by vagrant to unpack box files +) + +WORKINGDIR='/tmp/workingdir/' + +# Set working directory +buildah config --workingdir $WORKINGDIR $ctr + +# Get all updates and install needed rpms +buildah run $ctr -- dnf update -y +buildah run $ctr -- dnf install -y ${rpms[@]} + +# Add source code +buildah add $ctr './' $WORKINGDIR + +# Install bundler +# [1] when running with bundler 1.13.2 I had to comment out +# the vagrant-sshfs line in Gemfile because it errored out +# complaining about it being defined twice. Running with +# 1.12.5 works fine. +# [2] because of [1] need to add `--version 1.12.5` +buildah run $ctr -- gem install bundler --version 1.12.5 + +# Install all needed gems +buildah run $ctr -- bundle install --with plugins + +# Install all needed gems +buildah run $ctr -- bundle exec rake build + +# Copy built files outside of container +mount=$(buildah mount $ctr) +package=$(ls $mount/$WORKINGDIR/pkg/vagrant-sshfs-*gem) +echo "copying to ./$(basename $package)" +cp $package ./ +buildah umount $ctr + +echo "Built package is at ./$(basename $package)" diff --git a/features/README.md b/features/README.md deleted file mode 100644 index ac8a46d..0000000 --- a/features/README.md +++ /dev/null @@ -1,21 +0,0 @@ - -We are using Cucumber for automated testing. Read more at the -following two links: - -- [link1](https://en.wikipedia.org/wiki/Cucumber_(software)) -- [link2](http://www.methodsandtools.com/tools/cucumber.php) - -features/ - This is the features directory. The features directory Contains - feature files, which all have a .feature extension. May contain - subdirectories to organize feature files. - -features/step_definitions - This directory contains step definition files, which are Ruby code - and have a .rb extension. - -features/support - This directory contains supporting Ruby code. Files in support - load before those in step_definitions, which makes it useful for - such things as environment configuration (commonly done in a file - called env.rb). diff --git a/features/sshfs_cwd_mount.feature b/features/sshfs_cwd_mount.feature deleted file mode 100644 index c819d06..0000000 --- a/features/sshfs_cwd_mount.feature +++ /dev/null @@ -1,46 +0,0 @@ -# The language in this file is Gherkin. It is the language Cucumber -# uses to define test cases and is designed to be non-technical and -# human readable. All Gherkin files have a .feature extension -# -# See more here: https://en.wikipedia.org/wiki/Cucumber_(software) -# -# Additionally in the setup/env.rb file we set up Aruba. Aruba is used -# to define most of the basic step definitions that we use as part of -# the Gherkin syntax in this file. -# -# For more information on the step definitions provided see: -# https://github.com/cucumber/aruba/tree/bb5d7ff71809b5461e29153ded793d2b9a3a0624/features/testing_frameworks/cucumber/steps -# -Feature: SSHFS mount of vagrant current working directory - - Scenario Outline: SSHFS mounting of vagrant cwd - Given a file named "Vagrantfile" with: - """ - Vagrant.configure('2') do |config| - config.vm.box = '' - # Disable the default rsync - config.vm.synced_folder '.', '/vagrant', disabled: true - - # If using libvirt and nested virt (vagrant in vagrant) then - # we need to use a different network than 192.168.121.0 - config.vm.provider :libvirt do |libvirt| - libvirt.management_network_name = 'vagrant-libvirt-test' - libvirt.management_network_address = '192.168.129.0/24' - end - - # Mount up the current dir. It will have the Vagrantfile in there. - config.vm.synced_folder './', '/testdir', type: 'sshfs' - end - """ - When I successfully run `bundle exec vagrant up` - Then stdout from "bundle exec vagrant up" should contain "Installing SSHFS client..." - And stdout from "bundle exec vagrant up" should contain "Mounting SSHFS shared folder..." - And stdout from "bundle exec vagrant up" should contain "Folder Successfully Mounted!" - # The code for the following test is in ./step_definitions/sshfs_cwd_mount_steps.rb - And vagrant current working directory should be mounted - - Examples: - | box | - | centos/7 | - - diff --git a/features/step_definitions/sshfs_cwd_mount_steps.rb b/features/step_definitions/sshfs_cwd_mount_steps.rb deleted file mode 100644 index 74c378f..0000000 --- a/features/step_definitions/sshfs_cwd_mount_steps.rb +++ /dev/null @@ -1,12 +0,0 @@ -# This is a cucumber step definition. Cucumber scenarios become automated -# tests with the addition of what are called step definitions. A step -# definition is a block of code associated with one or more steps by a -# regular expression (or, in simple cases, a string). -# -# This is the step definition for the `And vagrant current working -# directory should be mounted` step from sshfs_cwd_mount.feature -# -And(/^vagrant current working directory should be mounted$/) do - run("vagrant ssh -c 'ls /testdir/Vagrantfile'") - expect(last_command_started).to have_exit_status(0) -end diff --git a/features/support/env.rb b/features/support/env.rb deleted file mode 100644 index 5f93cc1..0000000 --- a/features/support/env.rb +++ /dev/null @@ -1,27 +0,0 @@ -# This is a support file for the cucumber tests. This file sets up the -# environment for the tests to run. At this point mainly that means -# configuring Aruba. Aruba is used to define most of the basic step -# definitions that we use as part of the Gherkin syntax in our .feature files. -# -# For more information on the step definitions provided see: -# https://github.com/cucumber/aruba/tree/bb5d7ff71809b5461e29153ded793d2b9a3a0624/features/testing_frameworks/cucumber/steps -require 'aruba/cucumber' -require 'komenda' # use komenda for easily executing a command - -# Configure aruba. The options can be inferred from here: -# https://github.com/cucumber/aruba/tree/bb5d7ff71809b5461e29153ded793d2b9a3a0624/features/configuration -Aruba.configure do |config| - # Wait up to 300 seconds for the test to run - config.exit_timeout = 300 - # Output stdout and stderr on test failure - config.activate_announcer_on_command_failure = [:stdout, :stderr] - # The directory where the tests are to be run - config.working_directory = 'build/aruba' -end - -# After running tests, clean up -After do |_scenario| - if File.exist?(File.join(aruba.config.working_directory, 'Vagrantfile')) - Komenda.run('bundle exec vagrant destroy -f', cwd: aruba.config.working_directory, fail_on_fail: true) - end -end diff --git a/test/libvirt/README.txt b/test/libvirt/README.txt deleted file mode 100644 index 367134f..0000000 --- a/test/libvirt/README.txt +++ /dev/null @@ -1,23 +0,0 @@ - -To bring up vagrant host: - -vagrant up - -To run tests: - -vagrant ssh - -and then: - -cd /sharedfolder/code/github.com/dustymabe/vagrant-sshfs/ -gem install bundler # see [2] -bundle install --with plugins # see [1] -bundle exec rake featuretests - -[1] when running with bundler 1.13.2 I had to comment out - the vagrant-sshfs line in Gemfile because it errored out - complaining about it being defined twice. Running with - 1.12.5 works fine. -[2] because of [1] need to use this instead: - gem install bundler --version 1.12.5 - diff --git a/test/libvirt/Vagrantfile b/test/libvirt/Vagrantfile deleted file mode 100644 index 6ec3258..0000000 --- a/test/libvirt/Vagrantfile +++ /dev/null @@ -1,35 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : -Vagrant.configure(2) do |config| - - config.ssh.insert_key = 'true' - config.vm.synced_folder "/guests/sharedfolder", "/sharedfolder", type: "sshfs" - - config.vm.provider :libvirt do |domain| - domain.memory = 4096 - domain.cpus = 4 - domain.nested = true - end - - host = 'viv-libvirt' # vagrant in vagrant - to test libvirt - box = 'fedora/25-cloud-base' - - config.vm.define host do | tmp | - tmp.vm.hostname = host - tmp.vm.box = box - end - config.vm.provision "shell", inline: <<-SHELL - rpms=( - libvirt-daemon-kvm # for vagrant libvirt support - make gcc ruby ruby-devel redhat-rpm-config # for building gems - gcc-c++ # for building unf_ext - libvirt-devel # for building ruby-libvirt gem - zlib-devel # for building nokogiri gem - git # for the git ls-files in gemspec file - bsdtar # used by vagrant to unpack box files - ) - dnf install -y ${rpms[@]} - usermod -a -G libvirt vagrant - systemctl start libvirtd virtlogd - SHELL -end diff --git a/test/misc/README.txt b/test/misc/README.txt index f32520c..3821de8 100644 --- a/test/misc/README.txt +++ b/test/misc/README.txt @@ -2,7 +2,7 @@ # This directory is for testing the three different mount modes # that are supported by vagrant-sshfs -# To test we will first create the directory on the machien where +# To test we will first create the directory on the machine where # we will mount the guest /etc/ into the host (the reverse mount). mkdir /tmp/reverse_mount_etc diff --git a/test/misc/Vagrantfile b/test/misc/Vagrantfile index c7c7275..5723b68 100644 --- a/test/misc/Vagrantfile +++ b/test/misc/Vagrantfile @@ -22,7 +22,7 @@ Vagrant.configure(2) do |config| config.vm.synced_folder "/tmp/reverse_mount_etc/", "/etc", type: "sshfs", reverse: true host = 'vagrant-sshfs-tests' - box = 'fedora/25-cloud-base' + box = 'fedora/28-cloud-base' config.vm.define host do | tmp | tmp.vm.hostname = host diff --git a/test/virtualbox/README.txt b/test/virtualbox/README.txt deleted file mode 100644 index 2a683e0..0000000 --- a/test/virtualbox/README.txt +++ /dev/null @@ -1,25 +0,0 @@ -# XXX Note this is not working right now as nested virt. I keep -# getting kernel tracebacks on Fedora 24. - -To bring up vagrant host: - -vagrant up - -To run tests: - -vagrant ssh - -and then: - -cd /sharedfolder/code/github.com/dustymabe/vagrant-sshfs/ -gem install bundler # see [2] -bundle install --with plugins # see [1] -bundle exec rake featuretests - -[1] when running with bundler 1.13.2 I had to comment out - the vagrant-sshfs line in Gemfile because it errored out - complaining about it being defined twice. Running with - 1.12.5 works fine. -[2] because of [1] need to use this instead: - gem install bundler --version 1.12.5 - diff --git a/test/virtualbox/Vagrantfile b/test/virtualbox/Vagrantfile deleted file mode 100644 index def5bce..0000000 --- a/test/virtualbox/Vagrantfile +++ /dev/null @@ -1,42 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : -# -# XXX Note this is not working right now as nested virt. I keep -# getting kernel tracebacks on Fedora 24. -# -Vagrant.configure(2) do |config| - - config.ssh.insert_key = 'true' - config.vm.synced_folder "/guests/sharedfolder", "/sharedfolder", type: "sshfs" - - config.vm.provider :libvirt do |domain| - domain.memory = 4096 - domain.cpus = 4 - domain.nested = true - end - - host = 'viv-virtbox' # vagrant in vagrant - to test virtbox - box = 'fedora/25-cloud-base' - - config.vm.define host do | tmp | - tmp.vm.hostname = host - tmp.vm.box = box - end - # Must use VirtualBox-5.0 - 5.1 not supported by Vagrant yet - config.vm.provision "shell", inline: <<-SHELL - dnf config-manager --add-repo http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo - rpms=( - kernel-devel-$(uname -r) kernel-headers-$(uname -r) - gcc make VirtualBox-5.0 # all for virtualbox support - make gcc ruby ruby-devel redhat-rpm-config # for building gems - gcc-c++ # for building unf_ext - libvirt-devel # for building ruby-libvirt gem - zlib-devel # for building nokogiri gem - git # for the git ls-files in gemspec file - bsdtar # used by vagrant to unpack box files - ) - dnf install -y ${rpms[@]} - /usr/lib/virtualbox/vboxdrv.sh setup - usermod -a -G vboxusers vagrant - SHELL -end diff --git a/vagrant-sshfs.gemspec b/vagrant-sshfs.gemspec index d159b29..7ae93a2 100644 --- a/vagrant-sshfs.gemspec +++ b/vagrant-sshfs.gemspec @@ -25,7 +25,4 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake' - spec.add_development_dependency 'cucumber' - spec.add_development_dependency 'aruba' - spec.add_development_dependency 'komenda' end