minor improvement for api scenario runner (#692)

* minor improvement for api scenario runner

* fix typo

* remove cloudName default value to support customized armEndpoint

* remove cloudName support to add its support in wrapper

* update snapshot
This commit is contained in:
Zhenglai Zhang 2021-10-21 17:43:52 +08:00 коммит произвёл GitHub
Родитель 15bc328187
Коммит 9a2b04e9c2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -7,6 +7,10 @@ import { ResponseDiffItem, RuntimeError, StepResult, TestScenarioResult } from "
const spaceReg = /(\n|\t|\r)/gi;
const getErrorCodeDocLink = (code: string): string => {
return `https://github.com/Azure/azure-rest-api-specs/blob/main/documentation/api-scenario/references/ErrorCodeReference.md#${code}`;
};
const commonHelper = (opts: HelperOpts) => ({
renderPlain: (s: string) => s,
renderWhitespace: (n: number) => " ".repeat(n),
@ -56,9 +60,9 @@ const commonHelper = (opts: HelperOpts) => ({
`${hd.default(moment.duration(moment(end).diff(moment(start))).asMilliseconds())}`,
shouldReportError: (sr: TestScenarioMarkdownStepResult) =>
sr.failedErrorsCount + sr.fatalErrorsCount > 0,
renderFatalErrorCode: (e: RuntimeError) => `[${e.code}]()`,
renderFatalErrorCode: (e: RuntimeError) => `[${e.code}](${getErrorCodeDocLink(e.code)})`,
renderFatalErrorDetail: (e: RuntimeError) => `${e.message.replace(spaceReg, " ")}`,
renderDiffErrorCode: (e: ResponseDiffItem) => `[${e.code}]()`,
renderDiffErrorCode: (e: ResponseDiffItem) => `[${e.code}](${getErrorCodeDocLink(e.code)})`,
renderDiffErrorDetail: (e: ResponseDiffItem) => `${e.message.replace(spaceReg, " ")}`,
});

Просмотреть файл

@ -4,6 +4,6 @@ exports[`junitTestReport Should generate junit case report 1`] = `
"###Create or update a simple gallery with sharing profile.: 1 Fatal Error(s)
| Rule | Message |
|------|---------|
|<code>❌</code>[RUNTIME_ERROR_400]()|code: BadRequest, message: Subscription 'db5eb68e-73e2-4fa8-b18a-46cd1be4cce5' is not registered with the feature Microsoft.Compute/SIGSharing. Please register the subscription before retrying the call.|
|<code>❌</code>[RUNTIME_ERROR_400](https://github.com/Azure/azure-rest-api-specs/blob/main/documentation/api-scenario/references/ErrorCodeReference.md#RUNTIME_ERROR_400)|code: BadRequest, message: Subscription 'db5eb68e-73e2-4fa8-b18a-46cd1be4cce5' is not registered with the feature Microsoft.Compute/SIGSharing. Please register the subscription before retrying the call.|
"
`;

Просмотреть файл

@ -62,7 +62,7 @@ exports[`markdownReport Should generate markdown report: body 1`] = `
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rule&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| Message |
|------|---------|
| <code> ❌ </code> [RUNTIME_ERROR_400]() | code: BadRequest, message: Subscription 'db5eb68e-73e2-4fa8-b18a-46cd1be4cce5' is not registered with the feature Microsoft.Compute/SIGSharing. Please register the subscription before retrying the call. |
| <code> ❌ </code> [RUNTIME_ERROR_400](https://github.com/Azure/azure-rest-api-specs/blob/main/documentation/api-scenario/references/ErrorCodeReference.md#RUNTIME_ERROR_400) | code: BadRequest, message: Subscription 'db5eb68e-73e2-4fa8-b18a-46cd1be4cce5' is not registered with the feature Microsoft.Compute/SIGSharing. Please register the subscription before retrying the call. |
<br />
<li>
<code>