cyberark / conjur-service-broker

Implementation of the Open Service Broker API for Conjur

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Service broker has separate scripts for running unit and integration tests

izgeri opened this issue · comments

AC:

  • Service broker has bin/test_unit for running unit tests and bin/test_integration for running lightweight integration tests
  • Any tests that run against a remote TAS instance are isolated into their own test scripts, with the goal of eventually keeping only smoke tests in this repo and running full end-to-end tests when we build the tile.

Our current test script does everything, see https://github.com/cyberark/conjur-service-broker/blob/master/ci/test.sh#L7-L27

function main() {
    # TODO - The commented arguments are throwing an exeception unreleated to the
    # success of the RSpec test.  We need to get this resolved and export the
    # resulting XML file to the `spec/reports` folder for Jenkins to pickup.
    rspec # --format RspecJunitFormatter --out spec/reports/test.xml

    # Skip the integration tests if the Summon variables are not present
    if [ -z "$CF_API_ENDPOINT" ]; then
        INTEGRATION_TAG="--tags ~@integration"
    else
        # Make sure all of the environment are present for the integration tests
        : ${PCF_CONJUR_ACCOUNT?"Need to set PCF_CONJUR_ACCOUNT"}
        : ${PCF_CONJUR_APPLIANCE_URL?"Need to set PCF_CONJUR_APPLIANCE_URL"}
        : ${PCF_CONJUR_USERNAME?"Need to set PCF_CONJUR_USERNAME"}
        : ${PCF_CONJUR_API_KEY?"Need to set STATE"}

        install_buildpack
    fi

    cucumber --format junit \
    --out features/reports \
    $INTEGRATION_TAG \
    --format pretty \
    --backtrace \
    --verbose
}

The desired split should amount to the following:

bin/test_unit:

# TODO - The commented arguments are throwing an exeception unreleated to the
# success of the RSpec test.  We need to get this resolved and export the
# resulting XML file to the `spec/reports` folder for Jenkins to pickup.
rspec # --format RspecJunitFormatter --out spec/reports/test.xml

bin/test_integration:

# Excludes integration test scenarios (those that require external services)
cucumber --format junit \
--out features/reports \
--tags ~@integration \
--format pretty \
--backtrace \
--verbose

bin/test_e2e:

# Run integration tests only
cucumber --format junit \
--out features/reports \
--tags @integration \
--format pretty \
--backtrace \
--verbose