This commit is contained in:
Mangirdas Judeikis 2020-04-22 09:30:17 +01:00
Родитель 64c9193bce
Коммит 72d7ad30d0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: AA071F630E926BBD
1 изменённых файлов: 34 добавлений и 17 удалений

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

@ -1,8 +1,8 @@
# How-to `az aro` development
# az aro python development
ARO-RP distributed the CLI command `az aro` to control the cluster.
Currently the `aro` subcommand is merged in the
[azure-cli](https://github.com/azure/azure-cli) code base and
ARO-RP distributed the CLI command `az aro` to control the cluster.
Currently the `aro` subcommand is merged in the
[azure-cli](https://github.com/azure/azure-cli) code base and
is present as a command.
Currently, there are two codebases for `aro` subcommand:
@ -10,7 +10,8 @@ Currently, there are two codebases for `aro` subcommand:
* [upstream](https://github.com/Azure/ARO-RP/tree/master/python/az/aro) in main ARO-RP repo - which is an `az` extension
* [downstream][https://github.com/Azure/azure-cli/tree/dev/src/azure-cli/azure/cli/command_modules/aro] - which is an `az` command
Command is distributed alongside `az` and is automaticaly present in Azure cloud shell. Extension is installed as user action.
Command is distributed alongside `az` and is automaticaly present in Azure cloud
shell. Extension is installed as user action.
Currently code have to be in sync for upstream and downstream.
@ -38,6 +39,12 @@ Then run
```
azdev setup -c
```
if you are working on `aro extension`, you can use existing virtual env in
`ARO-RP` repository:
```
make pyenv
```
and follow the guide.
@ -45,17 +52,18 @@ Once setup, the work on tool can be started.
## Code
`aro` subcommand is placed in
`aro` subcommand/extension is placed in:
```
# azure-cli repository
.../azure-cli/src/azure-cli/azure/cli/command_modules/aro
# ARO-RP repository
.../ARO-RP/python/az/aro/azext_aro
```
with tests in
```
.../azure-cli/src/azure-cli/azure/cli/command_modules/aro/tests
```
with tests in corresponding repository `tests` folder.
There is wery useful guide for authoring commands in the
[azure-cli](https://github.com/Azure/azure-cli/tree/dev/doc/authoring_command_modules) repository.
@ -65,7 +73,7 @@ There is wery useful guide for authoring commands in the
Tests can be run with
```
azdev test aro (--live) (--verbose) (--debug)
azdev test aro (--live) (--lf) (--verbose) (--debug)
```
there are two main types of tests:
@ -86,17 +94,26 @@ recorded "tapes" are stored in the directory:
.../azure-cli/src/azure-cli/azure/cli/command_modules/aro/tests/latest/recordings
```
The test are recorded when the parameter `--live` is present, execution is forced to perform againts live Azure API. Every call is than recorded.
The test are recorded when the parameter `--live` is present, execution is
forced to perform against live Azure API. Every call is than recorded. Only failed
tests can be re-ran using `--lf` flag.
Recorded tests can be run as normal tests without the `--live`.
## Caveats
CI seems to not be isolated. Every run can fail or pass depending on the state of `dev` branch. Force push to rerun the tests.
* `azure-cli` CI seems to not be isolated. Every run can fail or pass depending
on the state of `dev` branch. Force push to rerun the tests.
Rebase has the potential to butcher the `venv`. Delete and recreate it. This solves the issues.
* Rebase has the potential to butcher the `venv`. Delete and recreate it. This
solves the issues.
Rebases are a must as the dependencies are downloaded in wrong versions and even local environemnt tend to break against the API.
* Rebases are a must as the dependencies are downloaded in wrong versions and even
local environment tend to break against the API.
When designing tests for live recording, care need to be taken. UUIDs
are changing in the recording to mask the fact that it is a recording.
* When designing tests for live recording, care need to be taken. UUIDs
are changing in the recording to mask the fact that it is a recording.
* When developing az aro extension in `ARO-RP` repository, make sure you use
[edge](https://github.com/Azure/azure-cli#edge-builds) CLI version to be as close
as possible to upstream version of azure-cli.