Skip to content

Commit 15a99a7

Browse files
committed
Add Vagrant VM for local integration testing
1 parent 180e615 commit 15a99a7

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

test/support/vm/openldap/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.vagrant

test/support/vm/openldap/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Local OpenLDAP Integration Testing
2+
3+
Set up a VM to run integration tests against OpenLDAP locally.
4+
5+
To run integration tests locally:
6+
7+
``` bash
8+
# start VM (from the correct directory)
9+
$ cd test/support/vm/openldap/
10+
$ vagrant up
11+
12+
# get the IP address of the VM
13+
$ ip=$(vagrant ssh -- "ifconfig eth1 | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n1")
14+
15+
# change back to root project directory
16+
$ cd ../../../..
17+
18+
# run all tests, including integration tests
19+
$ time INTEGRATION=openldap INTEGRATION_HOST=$ip bundle exec rake
20+
21+
# run a specific integration test file
22+
$ time INTEGRATION=openldap INTEGRATION_HOST=$ip bundle exec ruby test/integration/test_search.rb
23+
24+
# run integration tests by default
25+
$ export INTEGRATION=openldap
26+
$ export INTEGRATION_HOST=$ip
27+
28+
# now run tests without having to set ENV variables
29+
$ time bundle exec rake
30+
```

test/support/vm/openldap/Vagrantfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5+
VAGRANTFILE_API_VERSION = "2"
6+
7+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8+
config.vm.hostname = "freeipa.ghe.local"
9+
10+
config.vm.box = "hashicorp/precise64"
11+
12+
config.vm.network "private_network", type: :dhcp
13+
14+
config.ssh.forward_agent = true
15+
16+
config.vm.provision "shell", inline: "apt-get update; exec env /vagrant_data/script/install-openldap"
17+
18+
config.vm.synced_folder "../../../..", "/vagrant_data"
19+
20+
config.vm.provider "vmware_fusion" do |vb, override|
21+
override.vm.box = "hashicorp/precise64"
22+
vb.memory = 4596
23+
vb.vmx["displayname"] = "integration tests vm"
24+
vb.vmx["numvcpus"] = "2"
25+
end
26+
27+
config.vm.provider "virtualbox" do |vb, override|
28+
vb.memory = 4096
29+
vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
30+
vb.customize ["modifyvm", :id, "--chipset", "ich9"]
31+
vb.customize ["modifyvm", :id, "--vram", "16"]
32+
end
33+
end

0 commit comments

Comments
 (0)