Skip to content

Commit

Permalink
Try #51:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Jan 14, 2020
2 parents 2a0544d + c17f024 commit e5aae3c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
28 changes: 25 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,22 @@ workflows:
branches:
ignore:
- master
- test:
- publish_dev:
requires:
- validate
filters:
branches:
only:
- staging
- trying
- test:
requires:
- publish_dev
filters:
branches:
only:
- staging
- trying
- publish:
requires:
- test
Expand All @@ -39,7 +47,7 @@ jobs:
- checkout
- install-circleci
- pack-and-validate
test:
publish_dev:
docker:
- image: cimg/base:2019.08
working_directory: ~/repo
Expand All @@ -56,11 +64,24 @@ jobs:
echo "export ORB_VERSION=\"${ORB_VERSION}\"" >> $BASH_ENV
echo $ORB_VERSION
echo "export PR_MESSAGE=\"BotComment: *Development* version of orb available for manual validation - \\\`${ORB_VERSION}\\\`\"" >> $BASH_ENV
test:
docker:
- image: cimg/base:2019.08
working_directory: ~/repo
parallelism: 4
steps:
- checkout
- install-circleci
- pack-and-validate
- pr-info
- install-bats
- run:
name: Import Tests using BATS
command: |
export BATS_IMPORT_DEV_ORB="eddiewebb/<<pipeline.parameters.orbname>>@dev:${PR_NUMBER}"
export BATS_TEST_LIST=$(bats -l test | circleci tests split | tr '\n' ' ')
echo "This node will run ${BATS_TEST_LIST}"
bats test
- pr-comment

Expand Down Expand Up @@ -101,7 +122,8 @@ commands:
- run:
name: Install BATS (bash testing)
command: |
cd /tmp && git clone https://github.com/bats-core/bats-core.git && cd bats-core
# my fork includes tets list for splitting
cd /tmp && git clone https://github.com/eddiewebb/bats-core.git && cd bats-core
./install.sh /usr/local
- run:
name: Install YQ
Expand Down
22 changes: 22 additions & 0 deletions test/test_expansion.bats
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,28 @@ function setup {

}

@test "Default job sets block workflow properly" {
# given
process_config_with test/inputs/fulljob.yml

# when
assert_jq_match '.jobs | length' 1 #only 1 job
assert_jq_match '.jobs["Single File"].steps | length' 1 #only 1 steps

jq -r '.jobs["Single File"].steps[0].run.command' $JSON_PROJECT_CONFIG > ${BATS_TMPDIR}/script-${BATS_TEST_NUMBER}.bash

export CIRCLECI_API_KEY="madethisup"
export CIRCLE_BUILD_NUM="2"
export CIRCLE_JOB="singlejob"
export CIRCLE_PROJECT_USERNAME="madethisup"
export CIRCLE_PROJECT_REPONAME="madethisup"
export CIRCLE_REPOSITORY_URL="madethisup"
export CIRCLE_BRANCH="madethisup"

run bash ${BATS_TMPDIR}/script-${BATS_TEST_NUMBER}.bash
assert_contains_text "Orb parameter block-workflow is true."
}


# See https://github.com/eddiewebb/circleci-queue/issues/26 for explanation of race condition
@test "Race condition on previous workflow does not fool us" {
Expand Down

0 comments on commit e5aae3c

Please sign in to comment.