Skip to content

Commit

Permalink
Last version
Browse files Browse the repository at this point in the history
  • Loading branch information
croblesm committed Mar 5, 2024
1 parent f80ecd9 commit abee22d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/actions/smoke-test/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ popd
TEST_DIR="test/${TEMPLATE_ID}"
if [ -d "${TEST_DIR}" ] ; then
echo "(*) Copying test folder"
DEST_DIR="${SRC_DIR}/test-project"
DEST_DIR="${SRC_DIR}/dab-mssql"
mkdir -p ${DEST_DIR}
cp -Rp ${TEST_DIR}/* ${DEST_DIR}
cp test/test-utils/test-utils.sh ${DEST_DIR}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/smoke-test/test.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SRC_DIR="/tmp/${TEMPLATE_ID}"
echo "Running Smoke Test"

ID_LABEL="test-container=${TEMPLATE_ID}"
devcontainer exec --workspace-folder "${SRC_DIR}" --id-label ${ID_LABEL} /bin/sh -c 'set -e && if [ -f "test-project/test.sh" ]; then cd test-project && if [ "$(id -u)" = "0" ]; then chmod +x test.sh; else sudo chmod +x test.sh; fi && ./test.sh; else ls -a; fi'
devcontainer exec --workspace-folder "${SRC_DIR}" --id-label ${ID_LABEL} /bin/sh -c 'set -e && if [ -f "dab-mssql/test.sh" ]; then cd dab-mssql && if [ "$(id -u)" = "0" ]; then chmod +x test.sh; else sudo chmod +x test.sh; fi && ./test.sh; else ls -a; fi'

# Clean up
docker rm -f $(docker container ls -f "label=${ID_LABEL}" -q)
Expand Down
3 changes: 1 addition & 2 deletions test/dab-mssql/aspnetapp.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="3.0.0" />
</ItemGroup>
</Project>
32 changes: 32 additions & 0 deletions test/test-utils/test-utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

FAILED=()

echoStderr()
{
echo "$@" 1>&2
}

check() {
LABEL=$1
shift
echo -e "\n🧪 Testing $LABEL"
if "$@"; then
echo "✅ Passed!"
return 0
else
echoStderr "$LABEL check failed."
FAILED+=("$LABEL")
return 1
fi
}

reportResults() {
if [ ${#FAILED[@]} -ne 0 ]; then
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
exit 1
else
echo -e "\n💯 All passed!"
exit 0
fi
}

0 comments on commit abee22d

Please sign in to comment.