Skip to content

[CI] Add Vagrant box for running tests against OpenLDAP locally #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/support/vm/openldap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.vagrant
32 changes: 32 additions & 0 deletions test/support/vm/openldap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Local OpenLDAP Integration Testing

Set up a [Vagrant](http://www.vagrantup.com/) VM to run tests against OpenLDAP locally.

To run tests against OpenLDAP (instead of ApacheDS) locally:

``` bash
# start VM (from the correct directory)
$ cd test/support/vm/openldap/
$ vagrant up

# get the IP address of the VM
$ ip=$(vagrant ssh -- "ifconfig eth1 | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n1")

# change back to root project directory
$ cd ../../../..

# run all tests against OpenLDAP
$ time TESTENV=openldap OPENLDAP_HOST=$ip bundle exec rake

# run a specific test file against OpenLDAP
$ time TESTENV=openldap OPENLDAP_HOST=$ip bundle exec ruby test/membership_validators/recursive_test.rb

# run OpenLDAP tests by default
$ export TESTENV=openldap
$ export TESTENV=$ip

# now run tests without having to set ENV variables
$ time bundle exec rake
```

You may need to `gem install vagrant` first in order to provision the VM.
33 changes: 33 additions & 0 deletions test/support/vm/openldap/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.hostname = "openldap.github.org"

config.vm.box = "hashicorp/precise64"

config.vm.network "private_network", type: :dhcp

config.ssh.forward_agent = true

config.vm.provision "shell", inline: "apt-get update; exec env /vagrant_data/script/install-openldap"

config.vm.synced_folder "../../../..", "/vagrant_data"

config.vm.provider "vmware_fusion" do |vb, override|
override.vm.box = "hashicorp/precise64"
vb.memory = 4596
vb.vmx["displayname"] = "integration tests vm"
vb.vmx["numvcpus"] = "2"
end

config.vm.provider "virtualbox" do |vb, override|
vb.memory = 4096
vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
vb.customize ["modifyvm", :id, "--chipset", "ich9"]
vb.customize ["modifyvm", :id, "--vram", "16"]
end
end
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def options
instrumentation_service: @service
when "openldap"
{
host: 'localhost',
host: ENV.fetch("OPENLDAP_HOST", "localhost"),
port: 389,
admin_user: 'uid=admin,dc=github,dc=com',
admin_password: 'passworD1',
Expand Down