Skip to content

Commit

Permalink
remove tests - add build script
Browse files Browse the repository at this point in the history
- remove cucumber/aruba tests (they were fragile)
- remove vagrant-in-vagrant tests (they were fragile)
- add build.sh script for building (uses buildah)
  • Loading branch information
dustymabe committed Jun 30, 2018
1 parent 5cb3943 commit bb9c2f5
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 254 deletions.
6 changes: 0 additions & 6 deletions README.adoc
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions 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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions Rakefile
Expand Up @@ -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

27 changes: 27 additions & 0 deletions 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
48 changes: 48 additions & 0 deletions 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)"
21 changes: 0 additions & 21 deletions features/README.md

This file was deleted.

46 changes: 0 additions & 46 deletions features/sshfs_cwd_mount.feature

This file was deleted.

12 changes: 0 additions & 12 deletions features/step_definitions/sshfs_cwd_mount_steps.rb

This file was deleted.

27 changes: 0 additions & 27 deletions features/support/env.rb

This file was deleted.

23 changes: 0 additions & 23 deletions test/libvirt/README.txt

This file was deleted.

35 changes: 0 additions & 35 deletions test/libvirt/Vagrantfile

This file was deleted.

2 changes: 1 addition & 1 deletion test/misc/README.txt
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/misc/Vagrantfile
Expand Up @@ -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
Expand Down
25 changes: 0 additions & 25 deletions test/virtualbox/README.txt

This file was deleted.

42 changes: 0 additions & 42 deletions test/virtualbox/Vagrantfile

This file was deleted.

3 changes: 0 additions & 3 deletions vagrant-sshfs.gemspec
Expand Up @@ -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

0 comments on commit bb9c2f5

Please sign in to comment.