rootstrap/rails_api_base

View on GitHub
bin/parallel_tests

Summary

Maintainability
Test Coverage
#!/bin/bash
# This file should be in bin/parallel_tests

# updates CI node total based on parallel_tests concurrency
KNAPSACK_CI_NODE_TOTAL=$(( $PARALLEL_TESTS_CONCURRENCY * $KNAPSACK_CI_NODE_TOTAL ))

if [ "$TEST_ENV_NUMBER" == "" ]; then
  PARALLEL_TESTS_CONCURRENCY_INDEX=0
else
  PARALLEL_TESTS_CONCURRENCY_INDEX=$(( $TEST_ENV_NUMBER - 1 ))
fi

KNAPSACK_CI_NODE_INDEX=$(( $PARALLEL_TESTS_CONCURRENCY_INDEX + ($PARALLEL_TESTS_CONCURRENCY * $KNAPSACK_CI_NODE_INDEX) ))

# logs info about ENVs to ensure everything works
echo KNAPSACK_CI_NODE_TOTAL=$KNAPSACK_CI_NODE_TOTAL KNAPSACK_CI_NODE_INDEX=$KNAPSACK_CI_NODE_INDEX PARALLEL_TESTS_CONCURRENCY=$PARALLEL_TESTS_CONCURRENCY

CI_NODE_TOTAL=$KNAPSACK_CI_NODE_TOTAL CI_NODE_INDEX=$KNAPSACK_CI_NODE_INDEX bundle exec rails knapsack:rspec