Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

How to test

Enzo Rivello edited this page Mar 2, 2017 · 14 revisions

Prerequisites

Follow the instructions in how to create a local environment first, to install the essential tools to proceed.

Download the dependencies

Download ruby dependencies by typing

chef exec bundle

Download chef dependencies by typing:

chef exec berks

You are now ready for your first converge!

Run the local environment

Depending on the platform of your choice, you can fire a complete test suite by running:

chef exec bundle exec rake integration:#{platform}[#{suite},#{action}]

where:

  • platform is either vagrant or docker
  • suite is the name of your kitchen suite (e.g. community )
  • action is the name of your kitchen action
    • converge will fire up a local alfresco instance. (localhost for docker, 192.168.33.23 by default for vagrant)
    • verify will launch test on an existing instance
    • test will fire up the machine, launch the test then destroy the instance created
    • login will permit you to enter inside the created instance (the password for the kitchen user is kitchen)

warning: oh-my-zsh doesn't read rake arguments well. To solve this problem, wrap the command in quotation marks, like this:

chef exec bundle exec rake 'integration:#{platform}[#{suite},#{action}]'

Test workflow

Test setup is largely left to personal preference. However, this is the test flow that we use internally.

  1. Fork and Create a new branch from develop
  2. Fire up a local alfresco instance ( bundle exec rake integration:docker[community, converge] )
  3. Run the existing tests, to be sure that you are working on a clean slate ( chef exec bundle exec rake integration:docker[community, verify] )
  4. Write your tests first (under test//integration/#{suite_name}, then your features in Chef
  5. Run converge again (to bring the new changes to the existing environment)
  6. Run kitchen-test to see if the tests are passing
  7. Repeat steps from 4 to 6 up until you are satisfied with your result
  8. Destroy your local instance ( bundle exec rake integration:docker[community, converge] )
  9. Run Foodcritic either by typing the following in the project root folder:
  • chef exec foodcritic .
  • chef exec bundle exec rake
  1. Push your results to your local repo
  2. Make a pull request against Alfresco/develop

All pull requests needs to go to develop, any pull directly to master will be automatically turned down