- job:
    name: gate-blazar-devstack-dsvm
    node: ubuntu-xenial

    wrappers:
      - build-timeout:
          timeout: 70
      - timestamps

    builders:
      - link-logs
      - net-info
      - devstack-checkout
      - local_conf:
          conf: |
            [[local|localrc]]
            enable_plugin blazar git://git.openstack.org/openstack/blazar
      - shell: |
          #!/bin/bash -xe
          export PYTHONUNBUFFERED=true
          export DEVSTACK_GATE_TEMPEST=1
          export ENABLED_SERVICES=blazar,blazar-a,blazar-m,tempest
          export PROJECTS="openstack/blazar $PROJECTS"
          export PROJECTS="openstack/blazar-nova $PROJECTS"
          export PROJECTS="openstack/python-blazarclient $PROJECTS"

          # Construct a regex to limiting scope of tempest
          r="^(?:tempest\.cli\.simple_read_only\.test_.*reservation.*)"
          r="$r|^(?:tempest\.scenario\.test_.*reservation.*)"
          export DEVSTACK_GATE_TEMPEST_REGEX="$r"

          function pre_test_hook {
              # Install blazar tempest integration
              BLAZAR_TEMPEST_DIR=/opt/stack/new/blazar/contrib/tempest
              # Copying Tempest test suites
              # This will be removed once blazar's tempest starts to use TempestPlugin
              if [ -e $BLAZAR_TEMPEST_DIR ] ; then
                 TEMPEST_DIR=${TEMPEST_DIR:-/opt/stack/new/tempest}
                 cp -R $BLAZAR_TEMPEST_DIR/tempest/* $TEMPEST_DIR/tempest
              fi
          }
          export -f pre_test_hook

          cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
          ./safe-devstack-vm-gate-wrap.sh

    publishers:
      - devstack-logs
      - console-log