<commit_before>#!/usr/bin/env bash

set -e

: ${AWS_ACCESS_KEY_ID:?}
: ${AWS_SECRET_ACCESS_KEY:?}
: ${AWS_DEFAULT_REGION:?}

# NOTE: To run with specific line numbers, set:
# RSPEC_ARGUMENTS="spec/integration/lifecycle_spec.rb:mm:nn"
: ${RSPEC_ARGUMENTS:=spec/integration}
: ${METADATA_FILE:=environment/metadata}

release_dir="$( cd $(dirname $0) && cd ../.. && pwd )"

if [[ -f "/etc/profile.d/chruby.sh" ]] ; then
  source /etc/profile.d/chruby.sh
  chruby 2.1.2
fi

metadata=$(cat ${METADATA_FILE})

export BOSH_AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
export BOSH_AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
export BOSH_AWS_DEFAULT_KEY_NAME=$(echo ${metadata} | jq -e --raw-output ".default_key_name")
export BOSH_AWS_REGION=$(echo ${metadata} | jq -e --raw-output ".region")
export BOSH_AWS_SUBNET_ID=$(echo ${metadata} | jq -e --raw-output ".subnet_id")
export BOSH_AWS_MANUAL_SUBNET_ID=$(echo ${metadata} | jq -e --raw-output ".manual_subnet_id")
export BOSH_AWS_SUBNET_ZONE=$(echo ${metadata} | jq -e --raw-output ".az")
export BOSH_AWS_LIFECYCLE_MANUAL_IP=$(echo ${metadata} | jq -e --raw-output ".internal_ip")
export BOSH_AWS_ELB_ID=$(echo ${metadata} | jq -e --raw-output ".elb")
export BOSH_AWS_TARGET_GROUP_NAME=$(echo ${metadata} | jq -e --raw-output ".alb_target_group")
export BOSH_AWS_ELASTIC_IP=$(echo ${metadata} | jq -e --raw-output ".bats_eip")
export BOSH_AWS_MANUAL_IPV6_IP=$(echo ${metadata} | jq -e --raw-output ".manual_static_ipv6")
export BOSH_AWS_KMS_KEY_ARN=$(echo ${metadata} | jq -e --raw-output ".aws_kms_key_arn")

export BOSH_CLI_SILENCE_SLOW_LOAD_WARNING=true

pushd ${release_dir}/src/bosh_aws_cpi > /dev/null
  bundle install
  bundle exec parallel_rspec --serialize-stdout -- ${RSPEC_ARGUMENTS}
popd > /dev/null<commit_msg>do not run in parallel<commit_after>#!/usr/bin/env bash

set -e

: ${AWS_ACCESS_KEY_ID:?}
: ${AWS_SECRET_ACCESS_KEY:?}
: ${AWS_DEFAULT_REGION:?}

# NOTE: To run with specific line numbers, set:
# RSPEC_ARGUMENTS="spec/integration/lifecycle_spec.rb:mm:nn"
: ${RSPEC_ARGUMENTS:=spec/integration}
: ${METADATA_FILE:=environment/metadata}

release_dir="$( cd $(dirname $0) && cd ../.. && pwd )"

if [[ -f "/etc/profile.d/chruby.sh" ]] ; then
  source /etc/profile.d/chruby.sh
  chruby 2.1.2
fi

metadata=$(cat ${METADATA_FILE})

export BOSH_AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
export BOSH_AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
export BOSH_AWS_DEFAULT_KEY_NAME=$(echo ${metadata} | jq -e --raw-output ".default_key_name")
export BOSH_AWS_REGION=$(echo ${metadata} | jq -e --raw-output ".region")
export BOSH_AWS_SUBNET_ID=$(echo ${metadata} | jq -e --raw-output ".subnet_id")
export BOSH_AWS_MANUAL_SUBNET_ID=$(echo ${metadata} | jq -e --raw-output ".manual_subnet_id")
export BOSH_AWS_SUBNET_ZONE=$(echo ${metadata} | jq -e --raw-output ".az")
export BOSH_AWS_LIFECYCLE_MANUAL_IP=$(echo ${metadata} | jq -e --raw-output ".internal_ip")
export BOSH_AWS_ELB_ID=$(echo ${metadata} | jq -e --raw-output ".elb")
export BOSH_AWS_TARGET_GROUP_NAME=$(echo ${metadata} | jq -e --raw-output ".alb_target_group")
export BOSH_AWS_ELASTIC_IP=$(echo ${metadata} | jq -e --raw-output ".bats_eip")
export BOSH_AWS_MANUAL_IPV6_IP=$(echo ${metadata} | jq -e --raw-output ".manual_static_ipv6")
export BOSH_AWS_KMS_KEY_ARN=$(echo ${metadata} | jq -e --raw-output ".aws_kms_key_arn")

export BOSH_CLI_SILENCE_SLOW_LOAD_WARNING=true

pushd ${release_dir}/src/bosh_aws_cpi > /dev/null
  bundle install
  bundle exec rspec ${RSPEC_ARGUMENTS}
popd > /dev/null
{'fraction_non_alphanumeric': 0.16562143671607754, 'fraction_numerical': 0.0034207525655644243, 'mean_word_length': 5.595864661654136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5495566', 'n_tokens_mistral': 1488, 'n_tokens_neox': 1443, 'n_words': 262}