Skip to content

Commit

Permalink
test coverage for dotnet-monitor
Browse files Browse the repository at this point in the history
Adding test coverage for the diagnostic tool 'dotnet-monitor'.
  • Loading branch information
nicrowe00 committed Nov 21, 2023
1 parent d3d39e7 commit c3f7ccc
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dotnet-monitor-works/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "dotnet-monitor-works",
"enabled": true,
"requireSdk": true,
"version": "6.0",
"versionSpecific": false,
"type": "bash",
"cleanup": false,
"skipWhen": [
]
}
48 changes: 48 additions & 0 deletions dotnet-monitor-works/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

set -euo pipefail
set -x
IFS=$'\n\t'

IFS='.-' read -ra VERSION_SPLIT <<< "$1"
dotnet tool update -g dotnet-monitor --version "${VERSION_SPLIT[0]}.*-*"

export PATH="$HOME/.dotnet/tools:$PATH"

dotnet-monitor collect --no-auth &
sleep 5
indexhttps=$(wget --no-check-certificate -O https.html https://127.0.0.1:52323/info)

https=$(cat https.html)

if [[ $https == *"version"* ]]; then
sleep 5
echo "collect - OK"
else
sleep 5
pkill dotnet-monitor
rm "https.html"
echo "collect - FAIL"
exit 1
fi

pkill dotnet-monitor
rm "https.html"

config=$(dotnet-monitor config show)
if [[ $config == *"Metrics"* ]]; then
echo "config show - OK"
else
echo "config show - FAIL"
pkill dotnet-monitor
exit 1
fi

authkey=$(dotnet-monitor generatekey)
if [[ $authkey == *"Authorization: Bearer"* ]]; then
echo "generatekey - OK"
else
echo "generatekey - FAIL"
pkill dotnet-monitor
exit 1
fi

0 comments on commit c3f7ccc

Please sign in to comment.