diff --git a/test/support/vm/openldap/.gitignore b/test/support/vm/openldap/.gitignore new file mode 100644 index 0000000..dace708 --- /dev/null +++ b/test/support/vm/openldap/.gitignore @@ -0,0 +1 @@ +/.vagrant diff --git a/test/support/vm/openldap/README.md b/test/support/vm/openldap/README.md new file mode 100644 index 0000000..67a4ded --- /dev/null +++ b/test/support/vm/openldap/README.md @@ -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. diff --git a/test/support/vm/openldap/Vagrantfile b/test/support/vm/openldap/Vagrantfile new file mode 100644 index 0000000..3bb3981 --- /dev/null +++ b/test/support/vm/openldap/Vagrantfile @@ -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 diff --git a/test/test_helper.rb b/test/test_helper.rb index 8e4b6e9..7780371 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -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',
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: