-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TypeSpecRequirement] Add tests #29639
Conversation
mikeharder
commented
Jun 29, 2024
•
edited
Loading
edited
- Fixes [TypeSpecRequirement] Add end-to-end test #29009
PR validation pipeline restarted successfully. This comment will be populated with next steps to merge this PR once validation is completed. Please wait ⌛. |
Swagger Validation Report
|
Rule | Message |
---|---|
MISSING_README |
Can not find readme.md in the folder. If no readme.md file, it will block SDK generation. folder: resource-manager/Microsoft.HandWritten/preview/2024-01-01-preview |
MISSING_README |
Can not find readme.md in the folder. If no readme.md file, it will block SDK generation. folder: resource-manager/Microsoft.NoTspConfig/preview/2024-01-01-preview |
MISSING_README |
Can not find readme.md in the folder. If no readme.md file, it will block SDK generation. folder: resource-manager/Microsoft.ParseError/preview/2024-01-01-preview |
MISSING_README |
Can not find readme.md in the folder. If no readme.md file, it will block SDK generation. folder: resource-manager/Microsoft.Suppression/preview/2024-01-01-preview |
MISSING_README |
Can not find readme.md in the folder. If no readme.md file, it will block SDK generation. folder: resource-manager/Microsoft.TypeSpecGenerated/preview/2024-01-01-preview |
️❌
SwaggerAPIView: 1 Errors, 0 Warnings failed [Detail]
Rule | Message |
---|---|
Failed to generate swagger APIView. The readme file format is invalid and the tag is not defined. Use the provided readme template for guidance readme template. For more details, please check the detail log. |
"How to fix":"Check the readme file and make sure the readme file format is valid and the tag is defined. Use the provided readme template" |
️️✔️
TypeSpecAPIView succeeded [Detail] [Expand]
️️✔️
ModelValidation succeeded [Detail] [Expand]
Validation passes for ModelValidation.
️️✔️
SemanticValidation succeeded [Detail] [Expand]
Validation passes for SemanticValidation.
️️✔️
PoliCheck succeeded [Detail] [Expand]
Validation passed for PoliCheck.
️️✔️
SpellCheck succeeded [Detail] [Expand]
Validation passes for SpellCheck.
️️✔️
Lint(RPaaS) succeeded [Detail] [Expand]
Validation passes for Lint(RPaaS).
️️✔️
PR Summary succeeded [Detail] [Expand]
Validation passes for Summary.
️⌛
Automated merging requirements met pending [Detail]
Swagger Generation Artifacts
|
Rule | Message |
---|---|
RestBuild error |
"logUrl":"https://apidrop.visualstudio.com/Content%20CI/_build/results?buildId=436900&view=logs&j=fd490c07-0b22-5182-fac9-6d67fe1e939b", "detail":"Run.ps1 failed with exit code 1 " |
️🔄
$(sdkName) inProgress [Detail]
PR validation pipeline restarted successfully. If there is ApiView generated, it will be updated in this comment. |
@@ -59,7 +63,7 @@ $repoPath = Resolve-Path "$PSScriptRoot/../.." | |||
$pathsWithErrors = @() | |||
|
|||
$filesToCheck = $CheckAllUnder ? | |||
(Get-ChildItem -Path $CheckAllUnder -Recurse -File | Resolve-Path -Relative | ForEach-Object { $_ -replace '\\', '/' }) : | |||
(Get-ChildItem -Path $CheckAllUnder -Recurse -File | Resolve-Path -Relative -RelativeBasePath $repoPath | ForEach-Object { $_ -replace '\\', '/' }) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes bug when testing files outside root "specification" folder
| Where-Object { $_.Name -eq "tspconfig.yaml" }) | ||
if ($file -match "^.*specification/[^/]+/") { | ||
$rpFolder = $Matches[0]; | ||
$tspConfigs = @(Get-ChildItem -Path $rpFolder -Recurse -File | Where-Object { $_.Name -eq "tspconfig.yaml" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes bug when testing files outside root "specification" folder
@@ -176,12 +179,12 @@ else { | |||
if ($responseStatus -eq 200) { | |||
LogInfo " Branch 'main' contains path '$servicePath/stable', so spec already exists and is not required to use TypeSpec" | |||
} | |||
elseif ($response.StatusCode -eq 404) { | |||
elseif ($responseStatus -eq 404) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug fix (unlikely to hit in practice)
…-specs into tsr-unit-tests
@@ -15,7 +15,7 @@ function LogWarning { | |||
Write-Host ("##vso[task.LogIssue type=warning;]$args" -replace "`n", "%0D%0A") | |||
} | |||
elseif (Test-SupportsGitHubLogging) { | |||
Write-Host ("::warning::$args" -replace "`n", "%0D%0A") | |||
Write-Warning ("::warning::$args" -replace "`n", "%0D%0A") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this give us? Doesn't GH just interpret these logging messages and not display them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least for GH, it seemed more correct to use both the intended pwsh Write-*
method, along with including the GH-specific logging strings.
Write-Warning
might write to stdout instead of stderr, so it might not matter in practice. What did matter in practice was using Write-Error
instead of Write-Host
, to ensure errors are always written to stderr.
Example:
azure-rest-api-specs/eng/tools/typespec-requirement/test/typespec-requirement.test.ts
Lines 38 to 43 in c142d61
test.concurrent("No tspconfig.yaml", async ({ expect }) => { | |
const { stderr, exitCode } = await checkAllUnder("specification/no-tspconfig"); | |
expect(stderr).toContain("no files named 'tspconfig.yaml'"); | |
expect(exitCode).toBe(1); | |
}); |