From 9f3feda606197af37469a1781e6ae6477c1c567c Mon Sep 17 00:00:00 2001 From: Eric Mellino Date: Fri, 11 Mar 2016 14:24:09 -0800 Subject: [PATCH] Add sharedframework and sharedhost debian installer tests These are basic tests for now, which validate installation, upgrade, uninstall, etc. of the debian package itself. When the shared framework is fully functional, we will add more tests that cover real functionality. --- .../dotnet-sharedframework-debian_config.json | 2 +- .../package/package-sharedframework-debian.sh | 22 +++++++++++++++++++ scripts/package/package-sharedhost-debian.sh | 22 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/packaging/sharedframework/debian/dotnet-sharedframework-debian_config.json b/packaging/sharedframework/debian/dotnet-sharedframework-debian_config.json index 866a67515..93d32d198 100644 --- a/packaging/sharedframework/debian/dotnet-sharedframework-debian_config.json +++ b/packaging/sharedframework/debian/dotnet-sharedframework-debian_config.json @@ -29,7 +29,7 @@ }, "debian_dependencies":{ - "libssl-dev" : {}, + "libssl1.0.0" : {}, "libcurl3" : {} } } diff --git a/scripts/package/package-sharedframework-debian.sh b/scripts/package/package-sharedframework-debian.sh index f4d993c98..ef904c0ee 100755 --- a/scripts/package/package-sharedframework-debian.sh +++ b/scripts/package/package-sharedframework-debian.sh @@ -79,6 +79,7 @@ PACKAGING_TOOL_DIR="$REPOROOT/tools/DebianPackageTool" PACKAGE_OUTPUT_DIR="$OBJECT_DIR/deb_output" PACKAGE_LAYOUT_DIR="$OBJECT_DIR/deb_intermediate" +TEST_STAGE_DIR="$OBJECT_DIR/debian_tests" execute_build(){ create_empty_debian_layout @@ -125,8 +126,29 @@ update_debian_json() sed -i "s/%SHARED_FRAMEWORK_NUGET_VERSION%/$SHARED_FRAMEWORK_NUGET_VERSION/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json } +test_debian_package(){ + header "Testing debian package" + + install_bats + run_package_integrity_tests +} + +install_bats() { + rm -rf $TEST_STAGE_DIR + git clone https://github.com/sstephenson/bats.git $TEST_STAGE_DIR +} + +run_package_integrity_tests() { + # Set LAST_VERSION_URL to enable upgrade tests + # export LAST_VERSION_URL="$PREVIOUS_VERSION_URL" + + $TEST_STAGE_DIR/bin/bats $PACKAGE_OUTPUT_DIR/test_package.bats +} + execute_build DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb") +test_debian_package + mv -f "$DEBIAN_FILE" "$OUTPUT_DEBIAN_FILE" diff --git a/scripts/package/package-sharedhost-debian.sh b/scripts/package/package-sharedhost-debian.sh index 6ab255dc9..4c4ecb8db 100755 --- a/scripts/package/package-sharedhost-debian.sh +++ b/scripts/package/package-sharedhost-debian.sh @@ -64,6 +64,7 @@ PACKAGING_TOOL_DIR="$REPOROOT/tools/DebianPackageTool" PACKAGE_OUTPUT_DIR="$OBJECT_DIR/deb_output" PACKAGE_LAYOUT_DIR="$OBJECT_DIR/deb_intermediate" +TEST_STAGE_DIR="$OBJECT_DIR/debian_tests" execute_build(){ create_empty_debian_layout @@ -101,8 +102,29 @@ create_debian_package(){ "$PACKAGING_TOOL_DIR/package_tool" -i "$PACKAGE_LAYOUT_DIR" -o "$PACKAGE_OUTPUT_DIR" -v "$SHARED_HOST_DEBIAN_VERSION" } +test_debian_package(){ + header "Testing debian package" + + install_bats + run_package_integrity_tests +} + +install_bats() { + rm -rf $TEST_STAGE_DIR + git clone https://github.com/sstephenson/bats.git $TEST_STAGE_DIR +} + +run_package_integrity_tests() { + # Set LAST_VERSION_URL to enable upgrade tests + # export LAST_VERSION_URL="$PREVIOUS_VERSION_URL" + + $TEST_STAGE_DIR/bin/bats $PACKAGE_OUTPUT_DIR/test_package.bats +} + execute_build DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb") +test_debian_package + mv -f "$DEBIAN_FILE" "$OUTPUT_DEBIAN_FILE"