Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/shell/006_search.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ cfbs search mpf > mpf.log
cfbs search masterfiles > masterfiles.log

grep "python" all.log
! grep "python" mpf.log
if grep "python" mpf.log; then exit 1; fi
grep "masterfiles" mpf.log
grep "masterfiles" masterfiles.log
2 changes: 1 addition & 1 deletion tests/shell/008_remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ rm -rf .git
cfbs --non-interactive init
grep '"name": "masterfiles"' cfbs.json
cfbs --non-interactive remove masterfiles --non-interactive
! grep '"name": "masterfiles"' cfbs.json
if grep '"name": "masterfiles"' cfbs.json; then exit 1; fi
4 changes: 2 additions & 2 deletions tests/shell/009_clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ cfbs --non-interactive add promise-type-git
grep '"name": "library-for-promise-types-in-python"' cfbs.json
grep '"name": "promise-type-git"' cfbs.json
cfbs --non-interactive remove promise-type-git --non-interactive
! grep '"name": "library-for-promise-types-in-python"' cfbs.json
! grep '"name": "promise-type-git"' cfbs.json
if grep '"name": "library-for-promise-types-in-python"' cfbs.json; then exit 1; fi
if grep '"name": "promise-type-git"' cfbs.json; then exit 1; fi

# Check that clean does nothing:
cat cfbs.json > before.json
Expand Down
4 changes: 2 additions & 2 deletions tests/shell/029_init_masterfiles_version_3.18.1-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ grep '"version": "3.18.1-1"' cfbs.json
grep '"commit": "b6e9eacc65c797f4c2b4a59056293636c320d0c9"' cfbs.json
cfbs build
cfbs --non-interactive update
! grep '"version": "3.18.1-1"' cfbs.json
! grep '"commit": "b6e9eacc65c797f4c2b4a59056293636c320d0c9"' cfbs.json
if grep '"version": "3.18.1-1"' cfbs.json; then exit 1; fi
if grep '"commit": "b6e9eacc65c797f4c2b4a59056293636c320d0c9"' cfbs.json; then exit 1; fi
4 changes: 2 additions & 2 deletions tests/shell/030_get_set_input.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ echo '[
"response": "/tmp/test-2.txt"
}
]' > igors-input.json
! cfbs set-input create-single-file igors-input.json
if cfbs set-input create-single-file igors-input.json; then exit 1; fi

# Now Igor instead changes a key
echo '[
Expand All @@ -105,7 +105,7 @@ echo '[
"response": "/tmp/test-2.txt"
}
]' > igors-input.json
! cfbs set-input create-single-file igors-input.json
if cfbs set-input create-single-file igors-input.json; then exit 1; fi

# Igor changes the order but that's all right
echo '[
Expand Down
2 changes: 1 addition & 1 deletion tests/shell/041_add_multidep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ grep -F "Added module: test-inventory-local-groups" ./output.log
grep -F "Added module: test-inventory-local-users" ./output.log

# Adding modules together with their dependencies should not display skipping messages (CFE-3841):
! ( grep -F "Skipping already added" ./output.log )
if ( grep -F "Skipping already added" ./output.log ); then exit 1; fi

8 changes: 4 additions & 4 deletions tests/shell/043_replace_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ cp ../shell/043_replace_version/subdir/example.py ./subdir/example.py

# Before building, version number is 0.0.0:
grep 'print("Version: 0.0.0")' ./subdir/example.py
! grep 'print("Version: 1.2.3")' ./subdir/example.py
if grep 'print("Version: 1.2.3")' ./subdir/example.py; then exit 1; fi

cfbs build

# After building, input and output should be different:
! diff ./subdir/example.py ./out/masterfiles/services/cfbs/subdir/example.py
if diff ./subdir/example.py ./out/masterfiles/services/cfbs/subdir/example.py; then exit 1; fi

# Check that version number is correct in output:
grep 'print("Version: 1.2.3")' ./out/masterfiles/services/cfbs/subdir/example.py
! grep 'print("Version: 0.0.0")' ./out/masterfiles/services/cfbs/subdir/example.py
if grep 'print("Version: 0.0.0")' ./out/masterfiles/services/cfbs/subdir/example.py; then exit 1; fi

# Also check that the input was not modified:
grep 'print("Version: 0.0.0")' ./subdir/example.py
! grep 'print("Version: 1.2.3")' ./subdir/example.py
if grep 'print("Version: 1.2.3")' ./subdir/example.py; then exit 1; fi
2 changes: 1 addition & 1 deletion tests/shell/044_replace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cfbs build
ls out/masterfiles/services/cfbs/subdir/example.py

# Replace should have changed it:
! diff ./subdir/example.py out/masterfiles/services/cfbs/subdir/example.py > /dev/null
if diff ./subdir/example.py out/masterfiles/services/cfbs/subdir/example.py > /dev/null; then exit 1; fi

# This is the expected content:
diff ./subdir/example.expected.py out/masterfiles/services/cfbs/subdir/example.py
6 changes: 3 additions & 3 deletions tests/shell/048_remove_with_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ grep '"name": "example-dependency"' cfbs.json
cfbs --non-interactive remove example-module --non-interactive
cfbs validate

! grep '"name": "example-module"' cfbs.json
! grep '"name": "example-dependency"' cfbs.json
if grep '"name": "example-module"' cfbs.json; then exit 1; fi
if grep '"name": "example-dependency"' cfbs.json; then exit 1; fi



Expand All @@ -30,4 +30,4 @@ cfbs --non-interactive remove example-dependency --non-interactive
cfbs validate

grep '"name": "example-module"' cfbs.json
! grep '"name": "example-dependency"' cfbs.json
if grep '"name": "example-dependency"' cfbs.json; then exit 1; fi
8 changes: 4 additions & 4 deletions tests/shell/049_remove_with_circular_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ grep '"name": "example-dependency"' cfbs.json
cfbs --non-interactive remove example-module --non-interactive
cfbs validate

! grep '"name": "example-module"' cfbs.json
! grep '"name": "example-dependency"' cfbs.json
if grep '"name": "example-module"' cfbs.json; then exit 1; fi
if grep '"name": "example-dependency"' cfbs.json; then exit 1; fi



Expand All @@ -29,5 +29,5 @@ grep '"name": "example-dependency"' cfbs.json
cfbs --non-interactive remove example-dependency --non-interactive
cfbs validate

! grep '"name": "example-module"' cfbs.json
! grep '"name": "example-dependency"' cfbs.json
if grep '"name": "example-module"' cfbs.json; then exit 1; fi
if grep '"name": "example-dependency"' cfbs.json; then exit 1; fi
8 changes: 4 additions & 4 deletions tests/shell/052_get_input_module_not_found.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ echo '{
# Asks for the input of a module which is neither in the project nor in the
# index. This used to crash with an uncaught KeyError from the index, instead of
# reporting that the module was not found:
! cfbs get-input no-such-module-anywhere - 2> actual.error
if cfbs get-input no-such-module-anywhere - 2> actual.error; then exit 1; fi
grep "Module 'no-such-module-anywhere' not found" actual.error
! grep "Traceback" actual.error
if grep "Traceback" actual.error; then exit 1; fi

# Asks for the input of a module where version does not exist
! cfbs get-input delete-files@9.9.9 - 2> actual.error
if cfbs get-input delete-files@9.9.9 - 2> actual.error; then exit 1; fi
grep "Module 'delete-files@9.9.9' not found" actual.error
! grep "Traceback" actual.error
if grep "Traceback" actual.error; then exit 1; fi
8 changes: 4 additions & 4 deletions tests/shell/053_set_input_not_a_list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ echo '{
# Input data which is not a list of input definitions used to crash with an
# uncaught TypeError, instead of reporting that it doesn't conform:
echo '0' > actual.input
! cfbs set-input create-single-file actual.input 2> actual.error
if cfbs set-input create-single-file actual.input 2> actual.error; then exit 1; fi
grep "does not conform with input definition" actual.error
! grep "Traceback" actual.error
if grep "Traceback" actual.error; then exit 1; fi

# An empty object was silently accepted, since there was nothing to compare:
echo '{}' > actual.input
! cfbs set-input create-single-file actual.input 2> actual.error
if cfbs set-input create-single-file actual.input 2> actual.error; then exit 1; fi
grep "does not conform with input definition" actual.error
! grep "Traceback" actual.error
if grep "Traceback" actual.error; then exit 1; fi

# None of it was stored in the project:
test ! -e create-single-file/input.json
14 changes: 7 additions & 7 deletions tests/shell/058_render_input_fail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ echo '[
"response": "/tmp/create-single-file.txt"
}
]' > actual.input
! cfbs render-input create-single-file actual.input -
if cfbs render-input create-single-file actual.input -; then exit 1; fi

# Neither does a renamed key:
echo '[
Expand All @@ -48,19 +48,19 @@ echo '[
"response": "/tmp/create-single-file.txt"
}
]' > actual.input
! cfbs render-input create-single-file actual.input -
if cfbs render-input create-single-file actual.input -; then exit 1; fi

# Input data which doesn't parse as json:
echo 'not json' > actual.input
! cfbs render-input create-single-file actual.input -
if cfbs render-input create-single-file actual.input -; then exit 1; fi

# A module which doesn't accept any input:
echo '[]' > actual.input
! cfbs render-input autorun actual.input -
if cfbs render-input autorun actual.input -; then exit 1; fi

# A module which doesn't exist:
! cfbs render-input no-such-module-anywhere actual.input -
if cfbs render-input no-such-module-anywhere actual.input -; then exit 1; fi

# A missing outfile, and one argument too many:
! cfbs render-input create-single-file actual.input
! cfbs render-input create-single-file actual.input - -
if cfbs render-input create-single-file actual.input; then exit 1; fi
if cfbs render-input create-single-file actual.input - -; then exit 1; fi
Loading