Skip to content

Commit 44cd198

Browse files
authored
Try #51:
2 parents 2a0544d + c17f024 commit 44cd198

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

.circleci/config.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,22 @@ workflows:
1515
branches:
1616
ignore:
1717
- master
18-
- test:
18+
- publish_dev:
1919
requires:
2020
- validate
2121
filters:
2222
branches:
2323
only:
2424
- staging
2525
- trying
26+
- test:
27+
requires:
28+
- publish_dev
29+
filters:
30+
branches:
31+
only:
32+
- staging
33+
- trying
2634
- publish:
2735
requires:
2836
- test
@@ -39,7 +47,7 @@ jobs:
3947
- checkout
4048
- install-circleci
4149
- pack-and-validate
42-
test:
50+
publish_dev:
4351
docker:
4452
- image: cimg/base:2019.08
4553
working_directory: ~/repo
@@ -56,11 +64,24 @@ jobs:
5664
echo "export ORB_VERSION=\"${ORB_VERSION}\"" >> $BASH_ENV
5765
echo $ORB_VERSION
5866
echo "export PR_MESSAGE=\"BotComment: *Development* version of orb available for manual validation - \\\`${ORB_VERSION}\\\`\"" >> $BASH_ENV
67+
68+
test:
69+
docker:
70+
- image: cimg/base:2019.08
71+
working_directory: ~/repo
72+
parallelism: 4
73+
steps:
74+
- checkout
75+
- install-circleci
76+
- pack-and-validate
77+
- pr-info
5978
- install-bats
6079
- run:
6180
name: Import Tests using BATS
6281
command: |
6382
export BATS_IMPORT_DEV_ORB="eddiewebb/<<pipeline.parameters.orbname>>@dev:${PR_NUMBER}"
83+
export BATS_TEST_LIST=$(bats -l test | circleci tests split | tr '\n' ' ')
84+
echo "This node will run ${BATS_TEST_LIST}"
6485
bats test
6586
- pr-comment
6687

@@ -101,7 +122,8 @@ commands:
101122
- run:
102123
name: Install BATS (bash testing)
103124
command: |
104-
cd /tmp && git clone https://github.com/bats-core/bats-core.git && cd bats-core
125+
# my fork includes tets list for splitting
126+
cd /tmp && git clone https://github.com/eddiewebb/bats-core.git && cd bats-core
105127
./install.sh /usr/local
106128
- run:
107129
name: Install YQ

test/test_expansion.bats

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,28 @@ function setup {
5050

5151
}
5252

53+
@test "Default job sets block workflow properly" {
54+
# given
55+
process_config_with test/inputs/fulljob.yml
56+
57+
# when
58+
assert_jq_match '.jobs | length' 1 #only 1 job
59+
assert_jq_match '.jobs["Single File"].steps | length' 1 #only 1 steps
60+
61+
jq -r '.jobs["Single File"].steps[0].run.command' $JSON_PROJECT_CONFIG > ${BATS_TMPDIR}/script-${BATS_TEST_NUMBER}.bash
62+
63+
export CIRCLECI_API_KEY="madethisup"
64+
export CIRCLE_BUILD_NUM="2"
65+
export CIRCLE_JOB="singlejob"
66+
export CIRCLE_PROJECT_USERNAME="madethisup"
67+
export CIRCLE_PROJECT_REPONAME="madethisup"
68+
export CIRCLE_REPOSITORY_URL="madethisup"
69+
export CIRCLE_BRANCH="madethisup"
70+
71+
run bash ${BATS_TMPDIR}/script-${BATS_TEST_NUMBER}.bash
72+
assert_contains_text "Orb parameter block-workflow is true."
73+
}
74+
5375

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

0 commit comments

Comments
 (0)