Skip to content

Commit

Permalink
Add a few tests for depsolve
Browse files Browse the repository at this point in the history
because depsolve accepts NEVRA we only make a sanity test here.
Depsolving the example recipes will be done when testing bdcs-cli
because it has the notion of reading recipes.
  • Loading branch information
atodorov committed Sep 6, 2017
1 parent f35bc38 commit 3c1e81e
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions importer/tests/test_depsolve.sh
@@ -0,0 +1,38 @@
#!/bin/bash
# Note: execute from the project root directory

set -x

DEPSOLVE="./dist/build/depsolve/depsolve"

# when executed without parameters shows usage
if [[ `$DEPSOLVE` != "Usage: depsolve metadata.db NEVRA [NEVRA ...]" ]]; then
exit 1
fi

# when executed with non-existing DB returns non-zero
$DEPSOLVE /tmp/none.db httpd
if [[ $? == 0 ]]; then
echo "FAIL: Return code is zero"
exit 1
fi

### Prepare for testing depsolve against recipes

METADATA_DB="metadata.db"
[ -f "$METADATA_DB" ] || curl https://s3.amazonaws.com/weldr/metadata.db > "$METADATA_DB"

# when called with correct parameters
# then output contains input nevra
# and the return code is 0
OUTPUT=`$DEPSOLVE $METADATA_DB httpd-2.4.6-45.el7.centos.x86_64`
if [[ $? != 0 ]]; then
echo "FAIL: Return code is not zero"
exit 1
fi

echo "$OUTPUT" | grep httpd-2.4.6-45.el7.centos.x86_64
if [ $? != 0 ]; then
echo "FAIL: httpd not included in depsolved list"
exit 1
fi

0 comments on commit 3c1e81e

Please sign in to comment.