<commit_before>#!/bin/bash

#    Copyright 2016 Mirantis, Inc.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

set -eu

function usage {
  echo "Usage: $0 [OPTION]..."
  echo "Run Fuel UI functional tests"
  echo ""
  echo "  -h, --help                  Print this usage message"
  echo "      --no-ui-compression     Skip UI compression"
  echo "      --no-nailgun-start      Skip Nailgun start"
  exit
}

no_ui_compression=0
no_nailgun_start=0
tests=

function process_options {
  for arg in $@; do
    case "$arg" in
      -h|--help) usage;;
      --no-ui-compression) no_ui_compression=1;;
      --no-nailgun-start) no_nailgun_start=1;;
      -*);;
      *) tests="$tests $arg"
    esac
  done
}

FUEL_WEB_ROOT=$(readlink -f $(dirname $0)/..)
NAILGUN_ROOT=$FUEL_WEB_ROOT/nailgun

ARTIFACTS=${ARTIFACTS:-`pwd`/test_run}
mkdir -p $ARTIFACTS

export NAILGUN_STATIC=$ARTIFACTS/static
export NAILGUN_TEMPLATES=$NAILGUN_STATIC

export NAILGUN_PORT=${NAILGUN_PORT:-5544}
export NAILGUN_START_MAX_WAIT_TIME=${NAILGUN_START_MAX_WAIT_TIME:-30}

export NAILGUN_DB_HOST=${NAILGUN_DB_HOST:-/var/run/postgresql}
export NAILGUN_DB=${NAILGUN_DB:-nailgun}
export NAILGUN_DB_USER=${NAILGUN_DB_USER:-nailgun}
export NAILGUN_DB_USERPW=${NAILGUN_DB_USERPW:-<PASSWORD>}

export DB_ROOT=${DB_ROOT:-postgres}

export NAILGUN_FIXTURE_FILES="${NAILGUN_ROOT}/nailgun/fixtures/sample_environment.json ${NAILGUN_ROOT}/nailgun/fixtures/sample_plugins.json"

export NAILGUN_CHECK_URL='/api/version'


# Run UI functional tests.
#
# Arguments:
#
#   $@ -- tests to be run; with no arguments all tests will be run
function run_ui_func_tests {
  local GULP="./node_modules/.bin/gulp"<commit_msg>Fix artifacts path for UI functional tests<commit_after>#!/bin/bash

#    Copyright 2016 Mirantis, Inc.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

set -eu

function usage {
  echo "Usage: $0 [OPTION]..."
  echo "Run Fuel UI functional tests"
  echo ""
  echo "  -h, --help                  Print this usage message"
  echo "      --no-ui-compression     Skip UI compression"
  echo "      --no-nailgun-start      Skip Nailgun start"
  exit
}

no_ui_compression=0
no_nailgun_start=0
tests=

function process_options {
  for arg in $@; do
    case "$arg" in
      -h|--help) usage;;
      --no-ui-compression) no_ui_compression=1;;
      --no-nailgun-start) no_nailgun_start=1;;
      -*);;
      *) tests="$tests $arg"
    esac
  done
}

FUEL_WEB_ROOT=$(readlink -f $(dirname $0)/..)
NAILGUN_ROOT=$FUEL_WEB_ROOT/nailgun

ARTIFACTS=${ARTIFACTS:-`pwd`/test_run/ui_func}
mkdir -p $ARTIFACTS

export NAILGUN_STATIC=$ARTIFACTS/static
export NAILGUN_TEMPLATES=$NAILGUN_STATIC

export NAILGUN_PORT=${NAILGUN_PORT:-5544}
export NAILGUN_START_MAX_WAIT_TIME=${NAILGUN_START_MAX_WAIT_TIME:-30}

export NAILGUN_DB_HOST=${NAILGUN_DB_HOST:-/var/run/postgresql}
export NAILGUN_DB=${NAILGUN_DB:-nailgun}
export NAILGUN_DB_USER=${NAILGUN_DB_USER:-nailgun}
export NAILGUN_DB_USERPW=${NAILGUN_DB_USERPW:-nailgun}

export DB_ROOT=${DB_ROOT:-postgres}

export NAILGUN_FIXTURE_FILES="${NAILGUN_ROOT}/nailgun/fixtures/sample_environment.json ${NAILGUN_ROOT}/nailgun/fixtures/sample_plugins.json"

export NAILGUN_CHECK_URL='/api/version'


# Run UI functional tests.
#
# Arguments:
#
#   $@ -- tests to be run; with no arguments all tests will be run
function run_ui_func_tests {
  local GULP="./node_modules/.bin/gulp"
{'fraction_non_alphanumeric': 0.11158895427795383, 'fraction_numerical': 0.009053870529651425, 'mean_word_length': 3.8882743362831858, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6117349', 'n_tokens_mistral': 1604, 'n_tokens_neox': 1552, 'n_words': 387}