This commit is contained in:
2024-04-16 14:26:06 +03:00
parent bc264c4d90
commit e7c968797b
298 changed files with 11066 additions and 398 deletions

View File

@@ -0,0 +1,133 @@
# Авто тесты при переходе на новую версию платформы
## Содержание
- [Авто тесты при переходе на новую версию платформы](#авто-тесты-при-переходе-на-новую-версию-платформы)
- [Содержание](#содержание)
- [Подготовка к тестам](#подготовка-к-тестам)
- [Тесты Raw методов (Get, List)](#тесты-raw-методов-get-list)
- [Cloudapi](#cloudapi)
- [Cloudbroker](#cloudbroker)
- [Тесты запросов](#тесты-запросов)
- [Cloudapi](#cloudapi-1)
- [Cloudbroker](#cloudbroker-1)
- [Тесты API методов](#тесты-api-методов)
## Подготовка к тестам
1. Тесты находятся по директории `decort-sdk/tests/platform_upgrade`
2. Внутри директории нужно создать и заполнить файл `.env` по аналогии с `.env.template` для доступа к платформе
3. Внутри директории нужно создать и заполнить файл `input.json`, содержащий json с раздела [POST /system/docgenerator/prepareCatalog](https://delta.qa.loc/system/ActorApi?group=system#!/system__docgenerator/post_system_docgenerator_prepareCatalog) (для получения json нажать кнопку Try it Out!) - требуется только для тестов запросов
## Тесты Raw методов (Get, List)
### Cloudapi
Запустить тест `TestGetListCloudAPI` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
При наличии подсвеченных полей, проверить, что они содержатся на платформе и не содержатся в go структурах, завести и исправить ошибку.
Пример вывода:
```go
utils_get_list.go:71: Sizes list: OK
utils_get_list.go:71: Tasks list:
Platform has these fields that golang struct doesn't: [updatedBy guid]
utils_get_list.go:71: VINS list:
Platform has these fields that golang struct doesn't: [freeIPs extnetId]
utils_get_list.go:71: VINS get: OK
--- FAIL: TestGetListCloudAPI (66.13s)
```
### Cloudbroker
**ВНИМАНИЕ: из-за особенностей архитектуры моделей (вложенные структуры без json-тегов) в cloudbroker этот тест часто выдает некорректные результаты - ложноположительные на предмет багов.**
Запустить тест `TestGetListCloudbroker` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
При наличии подсвеченных полей, проверить, что они содержатся на платформе и не содержатся в go структурах, завести и исправить ошибку.
## Тесты запросов
### Cloudapi
Запустить тест `TestRequestsCloudAPI` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
При наличии подсвеченных ошибок, проверить, что они являются ошибками (возможны ситуации, когда расхождение платформы и sdk задумано специально), завести и исправить ошибку.
Пример вывода:
```go
=== RUN TestRequestsCloudAPI
utils_requests.go:125: Path /cloudapi/compute/affinityRuleRemove has following errors: [Field value has different required parameters on the platform and in golang structure]
utils_requests.go:125: Path /cloudapi/lb/listDeleted has following errors: [Platform has field accountId that golang structure doesn't]
utils_requests.go:125: Path /cloudapi/compute/pfwAdd has following errors: [Field localBasePort has different required parameters on the platform and in golang structure]
utils_requests.go:125: Path /cloudapi/kvmppc/create has following errors: [Field interfaces has different type parameters on the platform and in golang structure]
utils_requests.go:125: Path /cloudapi/image/create has following errors: [Platform (14) and golang structure (15) have different amount of fields. Field accountId has different required parameters on the platform and in golang structure]
<...>
utils_requests.go:125: Path /cloudapi/compute/affinityRuleAdd has following errors: [Field value has different required parameters on the platform and in golang structure]
utils_requests.go:125: Path /cloudapi/compute/antiAffinityRuleAdd has following errors: [Field value has different required parameters on the platform and in golang structure]
utils_requests.go:125: Path /cloudapi/lb/create has following errors: [Platform (7) and golang structure (8) have different amount of fields. Field extnetId has different required parameters on the platform and in golang structure Field vinsId has different required parameters on the platform and in golang structure]
--- FAIL: TestRequestsCloudAPI (0.02s)
FAIL
```
### Cloudbroker
Запустить тест `TestRequestsCloudbroker` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
При наличии подсвеченных ошибок, проверить, что они являются ошибками (возможны ситуации, когда расхождение платформы и sdk задумано специально), завести и исправить ошибку.
Пример вывода:
```go
=== RUN TestRequestsCloudbroker
utils_requests.go:125: Path /cloudbroker/image/updateNodes has following errors: [Field enabledStacks has different type parameters on the platform and in golang structure]
utils_requests.go:125: Path /cloudbroker/lb/listDeleted has following errors: [Platform has field accountId that golang structure doesn't]
utils_requests.go:125: Path /cloudbroker/k8ci/listDeleted has following errors: [Platform has field k8cId that golang structure doesn't]
<...>
utils_requests.go:125: Path /cloudbroker/account/setCpuAllocationRatio has following errors: [Platform has field accountId that golang structure doesn't Field ratio has different required parameters on the platform and in golang structure]
utils_requests.go:125: Path /cloudbroker/image/list has following errors: [Field size has different type parameters on the platform and in golang structure]
utils_requests.go:125: Path /cloudbroker/rg/create has following errors: [Platform has field uniqPools that golang structure doesn't]
utils_requests.go:125: Path /cloudbroker/sep/create has following errors: [Field config has different required parameters on the platform and in golang structure]
--- FAIL: TestRequestsCloudbroker (0.02s)
FAIL
```
## Тесты API методов
Запустить тест `TestGetAllPaths` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
При наличии подсвеченных ошибок, проверить, что указанные методы API не являются устаревшими (deprecated). В противном случе добавить устаревшие методы в переменную `DEPRECATED_GROUPS` по адресу `decort-sdk/tests/platform_upgrade/utils_url.go`.
Пример вывода:
```go
=== RUN TestGetAllPaths
cloud_test.go:692: Below API handlers (30 in total) need to be added to decort-sdk:
/cloudbroker/grid/addCustomBackupPath
/cloudapi/user/getResourceConsumption
/cloudapi/user/authenticate
/cloudbroker/compute/getCustomFields
/cloudapi/user/isValidInviteUserToken
/cloudapi/pcidevice/list
/cloudbroker/compute/createTemplateFromBlank
/cloudbroker/account/listVMs
/cloudapi/user/brief
/cloudapi/user/search
/cloudbroker/stack/setMemAllocationRatio
/cloudbroker/image/computeciUnset
/cloudbroker/image/uploadImageFile
/cloudapi/account/getStats
/cloudapi/disks/fromPlatformDisk
/cloudbroker/stack/getLogicalCoresCount
/cloudapi/lb/stop
/cloudapi/account/listVMs
/cloudapi/user/setData
/cloudapi/compute/createTemplateFromBlank
/cloudbroker/grid/removeCustomBackupPath
/cloudapi/user/getAudit
/cloudbroker/account/listCS
/cloudapi/account/listCS
/cloudbroker/stack/setCpuAllocationRatio
/cloudbroker/grid/setPasswordPolicy
/cloudapi/user/apiList
/cloudbroker/disks/fromPlatformDisk
/cloudapi/user/get
/cloudapi/vgpu/list
--- FAIL: TestGetAllPaths (0.03s)
FAIL
exit status 1
FAIL repository.basistech.ru/BASIS/decort-golang-sdk/tests/platform_upgrade 0.031s
```