Search code examples
beaker

Docker testing environment


I just did the configuration explained on the docs for docker.

HOSTS:
  ubuntu-12-10:
    platform: ubuntu-12.10-x64
    image: ubuntu:12.10
    hypervisor: docker
CONFIG: 
  type: foss

But I am getting this stacktrace after launching beaker:

ubuntu@ip-xxx-xx-xx-xxx:~$ beaker --hosts test-environment.yaml
/var/lib/gems/1.9.1/gems/beaker-1.12.2/lib/beaker/options/options_hash.rb:27:in `[]': undefined method `to_sym' for 0:Fixnum (NoMethodError)
    from /var/lib/gems/1.9.1/gems/beaker-1.12.2/lib/beaker/options/parser.rb:152:in `set_default_host!'
    from /var/lib/gems/1.9.1/gems/beaker-1.12.2/lib/beaker/options/parser.rb:346:in `normalize_args'
    from /var/lib/gems/1.9.1/gems/beaker-1.12.2/lib/beaker/options/parser.rb:211:in `parse_args'
    from /var/lib/gems/1.9.1/gems/beaker-1.12.2/lib/beaker/cli.rb:14:in `initialize'
    from /var/lib/gems/1.9.1/gems/beaker-1.12.2/bin/beaker:6:in `new'
    from /var/lib/gems/1.9.1/gems/beaker-1.12.2/bin/beaker:6:in `<top (required)>'
    from /usr/local/bin/beaker:23:in `load'
    from /usr/local/bin/beaker:23:in `<main>'

Solution

  • The method

    set_default_host!(hosts)

    of the parser library requires that you have at least a default or master role defined in your hosts.

    Add the 'default' role to the host determined to be the default. If a host already has the role default then do nothing. If more than a single host has the role 'default', raise error. Default host determined to be 1) the only host in a single host configuration, 2) the host with the role 'master' defined.

    See http://www.rdoc.info/github/puppetlabs/beaker/frames/Beaker/Options/Parser

    Also, you would probably need to install the gem docker-api, see https://github.com/swipely/docker-api

    For future references I have documented the steps here http://varmenise.tumblr.com/post/89252765948/beaker-acceptance-tests-on-modules-with-docker-tests