2
This commit is contained in:
+34
-8
@@ -1,15 +1,30 @@
|
||||
param(
|
||||
[string] $ApiExecutablePath,
|
||||
[string] $ApiContentRoot
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$workspaceRoot = Split-Path -Parent $PSScriptRoot
|
||||
$apiProjectDirectory = Join-Path $workspaceRoot 'src/Jiaowu.Api'
|
||||
$apiExecutable = Join-Path $workspaceRoot 'src/Jiaowu.Api/bin/Debug/net10.0/Jiaowu.Api.exe'
|
||||
$apiExecutable = if ([string]::IsNullOrWhiteSpace($ApiExecutablePath)) {
|
||||
Join-Path $workspaceRoot 'src/Jiaowu.Api/bin/Debug/net10.0/Jiaowu.Api.exe'
|
||||
}
|
||||
else {
|
||||
[System.IO.Path]::GetFullPath($ApiExecutablePath, $workspaceRoot)
|
||||
}
|
||||
$apiWorkingDirectory = if ([string]::IsNullOrWhiteSpace($ApiContentRoot)) {
|
||||
Join-Path $workspaceRoot 'src/Jiaowu.Api'
|
||||
}
|
||||
else {
|
||||
[System.IO.Path]::GetFullPath($ApiContentRoot, $workspaceRoot)
|
||||
}
|
||||
$stdoutPath = Join-Path $env:TEMP 'jiaowu-api-smoke.out.log'
|
||||
$stderrPath = Join-Path $env:TEMP 'jiaowu-api-smoke.err.log'
|
||||
$env:ASPNETCORE_ENVIRONMENT = 'Development'
|
||||
$env:ASPNETCORE_URLS = 'http://localhost:5255'
|
||||
$startParameters = @{
|
||||
FilePath = $apiExecutable
|
||||
WorkingDirectory = $apiProjectDirectory
|
||||
WorkingDirectory = $apiWorkingDirectory
|
||||
WindowStyle = 'Hidden'
|
||||
RedirectStandardOutput = $stdoutPath
|
||||
RedirectStandardError = $stderrPath
|
||||
@@ -51,13 +66,24 @@ try {
|
||||
$headers = @{ Authorization = "Bearer $($login.token)" }
|
||||
$dashboard = Invoke-RestMethod -Uri 'http://localhost:5255/api/dashboard' -Headers $headers
|
||||
$campuses = Invoke-RestMethod -Uri 'http://localhost:5255/api/base-data/campuses' -Headers $headers
|
||||
$frontend = Invoke-WebRequest -Uri 'http://localhost:5255/' -TimeoutSec 5
|
||||
$spaFallback = Invoke-WebRequest -Uri 'http://localhost:5255/base-data' -TimeoutSec 5
|
||||
$unknownApiParameters = @{
|
||||
Uri = 'http://localhost:5255/api/does-not-exist'
|
||||
SkipHttpErrorCheck = $true
|
||||
TimeoutSec = 5
|
||||
}
|
||||
$unknownApi = Invoke-WebRequest @unknownApiParameters
|
||||
|
||||
[pscustomobject]@{
|
||||
Health = $health.status
|
||||
Database = $health.database
|
||||
User = $login.user.displayName
|
||||
Term = $dashboard.currentTerm.name
|
||||
Campuses = @($campuses).Count
|
||||
Health = $health.status
|
||||
Database = $health.database
|
||||
User = $login.user.displayName
|
||||
Term = $dashboard.currentTerm.name
|
||||
Campuses = @($campuses).Count
|
||||
StaticIndex = $frontend.Content.Contains('明序教务管理系统')
|
||||
SpaFallback = $spaFallback.StatusCode
|
||||
ApiNotFound = $unknownApi.StatusCode
|
||||
} | Format-List
|
||||
}
|
||||
finally {
|
||||
|
||||
Reference in New Issue
Block a user