Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
Add Server Test Baseline (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
LianwMS authored Jun 18, 2020
1 parent b2a807b commit 9959e2b
Show file tree
Hide file tree
Showing 44 changed files with 10,387 additions and 2 deletions.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,28 @@
"author": "Microsoft Corporation",
"license": "MIT",
"devDependencies": {
"@microsoft.azure/autorest.testserver": "^2.10.45",
"@types/chai": "^4.2.7",
"@types/mocha": "^5.2.5",
"@types/node": "10.17.0",
"bufferutil": "^4.0.1",
"chai": "^4.2.0",
"eslint": "~5.4.0",
"mocha": "^5.2.0",
"mocha-typescript": "^1.1.17",
"node-yaml": "^3.2.0",
"nyc": "^15.0.0",
"source-map-support": "^0.5.13",
"typescript": "^3.7.5"
"typescript": "^3.7.5",
"utf-8-validate": "^5.0.2"
},
"dependencies": {
"autorest": "^3.0.6187",
"@azure-tools/async-io": "^3.0.209",
"@azure-tools/autorest-extension-base": "~3.1.235",
"@azure-tools/codegen": "^2.5.276",
"@azure-tools/codemodel": "4.13.325",
"@azure-tools/linq": "^3.1.232",
"autorest": "^3.0.6187",
"await-exec": "^0.1.2",
"dir-compare": "^2.2.0",
"js-yaml": "^3.13.1",
Expand Down
27 changes: 27 additions & 0 deletions src/test/scenarios/testserver/configuration/readme.az.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## CLI

These settings apply only when `--az` is specified on the command line.

``` yaml $(az)
az:
extensions: testserver
package-name: azure-mgmt-testserver
namespace: azure.mgmt.testserver
client-subscription-bound: false
client-base-url-bound: false
client-authentication-policy: SansIOHTTPPolicy
az-output-folder: $(azure-cli-extension-folder)/src/testserver
python-sdk-output-folder: "$(az-output-folder)/azext_testserver/vendored_sdks/testserver"

#cli:
# cli-directive:
# directive on operationGroup
# - select: 'operationGroup'
# where:
# operationGroup: 'operations'
# hidden: true
# - where:
# parameter: location
# required: true

```
9 changes: 9 additions & 0 deletions src/test/scenarios/testserver/configuration/readme.cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CLI

These settings apply only when `--cli` is specified on the command line.

``` yaml $(cli)
#cli:
# test-scenario:
# - name: Factories_CreateOrUpdate
```
60 changes: 60 additions & 0 deletions src/test/scenarios/testserver/configuration/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Managed Network

> see https://aka.ms/autorest
This is the AutoRest configuration file for Managed Network.



---
## Getting Started
To build the SDK for Managed Network, simply [Install AutoRest](https://aka.ms/autorest/install) and in this folder, run:

> `autorest`
To see additional help and options, run:

> `autorest --help`
---

## Configuration



### Basic Information
These are the global settings for the Managed Network API.

``` yaml
openapi-type: arm
tag: testserver-2-7-8
override-info:
title: AutoRest Test Service
description: Test Infrastructure for AutoRest.
```
### Tag: testserver-2-7-8
These settings apply only when `--tag=testserver-2-7-8` is specified on the command line.

``` yaml $(tag) == 'testserver-2-7-8'
input-file:
- ../../../../../node_modules/@microsoft.azure/autorest.testserver/swagger/body-array.json
- ../../../../../node_modules/@microsoft.azure/autorest.testserver/swagger/body-boolean.json
```
# Code Generation


## Swagger to SDK

This section describes what SDK should be generated by the automatic system.
This is not used by Autorest itself.

``` yaml $(swagger-to-sdk)
swagger-to-sdk:
- repo: azure-sdk-for-python
```


## CLI

See configuration in [readme.cli.md](./readme.cli.md)
26 changes: 26 additions & 0 deletions src/test/scenarios/testserver/configuration/readme.python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Python

These settings apply only when `--python` is specified on the command line.
Please also specify `--python-sdks-folder=<path to the root directory of your azure-sdk-for-python clone>`.
Use `--python-mode=update` if you already have a setup.py and just want to update the code itself.

``` yaml $(python)
python:
azure-arm: true
license-header: MICROSOFT_MIT_NO_VERSION
payload-flattening-threshold: 2
namespace: azure.mgmt.testserver
package-name: azure-mgmt-testserver
package-version: 0.1.0
clear-output-folder: true
```
``` yaml $(python) && $(python-mode) == 'update'
python:
no-namespace-folders: true
output-folder: $(python-sdks-folder)/testserver/azure-mgmt-testserver/azure/mgmt/testserver
```
``` yaml $(python) && $(python-mode) == 'create'
python:
basic-setup-py: true
output-folder: $(python-sdks-folder)/testserver/azure-mgmt-testserver
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:
Release History
===============

0.1.0
++++++
* Initial release.
5 changes: 5 additions & 0 deletions src/test/scenarios/testserver/output/src/testserver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Microsoft Azure CLI 'testserver' Extension
==========================================

This package is for the 'testserver' extension.
i.e. 'az testserver'
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_testserver.generated._help import helps # pylint: disable=unused-import
try:
from azext_testserver.manual._help import helps
except ImportError:
pass


class AutoRestTestServiceCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_testserver.generated._client_factory import cf_testserver_cl
testserver_custom = CliCommandType(
operations_tmpl='azext_testserver.custom#{}',
client_factory=cf_testserver_cl)
parent = super(AutoRestTestServiceCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=testserver_custom)

def load_command_table(self, args):
from azext_testserver.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_testserver.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
return self.command_table

def load_arguments(self, command):
from azext_testserver.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_testserver.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = AutoRestTestServiceCommandsLoader
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------


def cf_testserver_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.testserver import AutoRestTestService
from azure.core.pipeline.policies import SansIOHTTPPolicy
return get_mgmt_service_client(cli_ctx,
AutoRestTestService,
subscription_bound=False,
base_url_bound=False,
authentication_policy=SansIOHTTPPolicy())


def cf_array(cli_ctx, *_):
return cf_testserver_cl(cli_ctx).array


def cf_bool(cli_ctx, *_):
return cf_testserver_cl(cli_ctx).bool
Loading

0 comments on commit 9959e2b

Please sign in to comment.