Files
decort-golang-sdk/tests/platform_upgrade/README.md

151 lines
10 KiB
Markdown
Raw Normal View History

2024-04-16 14:26:06 +03:00
# Авто тесты при переходе на новую версию платформы
## Содержание
- [Авто тесты при переходе на новую версию платформы](#авто-тесты-при-переходе-на-новую-версию-платформы)
- [Содержание](#содержание)
- [Подготовка к тестам](#подготовка-к-тестам)
- [Тесты Raw методов (Get, List)](#тесты-raw-методов-get-list)
- [Cloudapi](#cloudapi)
- [Cloudbroker](#cloudbroker)
2025-12-23 17:39:58 +03:00
- [SDN](#sdn)
2024-04-16 14:26:06 +03:00
- [Тесты запросов](#тесты-запросов)
- [Cloudapi](#cloudapi-1)
- [Cloudbroker](#cloudbroker-1)
2025-12-23 17:39:58 +03:00
- [SDN](#sdn-1)
2024-04-16 14:26:06 +03:00
- [Тесты API методов](#тесты-api-методов)
## Подготовка к тестам
1. Тесты находятся по директории `decort-sdk/tests/platform_upgrade`
2. Внутри директории нужно создать и заполнить файл `.env` по аналогии с `.env.template` для доступа к платформе
2025-05-07 13:15:39 +03:00
3. Внутри директории нужно создать и заполнить файл `input.json`, содержащий json из метода [POST /system/docgenerator/prepareCatalog](https://delta.qa.loc/portal/#/api/system) (для получения json нажать кнопку Try it Out!) - требуется только для тестов запросов и тестов API методов
2024-05-31 13:35:39 +03:00
Примечание: тесты можно запускать напрямую методами среды разработки либо из командной строки из нужной директории, например командой `go test -v -run <TestName>`, где `<TestName>` - название запускаемого теста.
2024-04-16 14:26:06 +03:00
## Тесты 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 структурах, завести и исправить ошибку.
2025-12-23 17:39:58 +03:00
### SDN
Запустить тест `TestGetListSDNAPI` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
При наличии подсвеченных полей, проверить, что они содержатся на платформе и не содержатся в go структурах, завести и исправить ошибку.
Пример вывода аналогичен тестам для Cloudapi и Cloudbroker.
2024-04-16 14:26:06 +03:00
## Тесты запросов
### 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
2025-12-08 16:16:35 +03:00
utils_requests.go:125: Path /cloudbroker/image/updateNodes has following errors: [Field enabledNodes has different type parameters on the platform and in golang structure]
2024-04-16 14:26:06 +03:00
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
```
2025-12-23 17:39:58 +03:00
### SDN
Запустить тест `TestRequestsSDN` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
При наличии подсвеченных ошибок, проверить, что они являются ошибками (возможны ситуации, когда расхождение платформы и sdk задумано специально), завести и исправить ошибку.
Пример вывода аналогичен тестам для Cloudapi и Cloudbroker.
2024-04-16 14:26:06 +03:00
## Тесты API методов
Запустить тест `TestGetAllPaths` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
2024-05-31 13:35:39 +03:00
При наличии подсвеченных ошибок, проверить, что указанные методы API не являются устаревшими (deprecated). В противном случае добавить устаревшие методы в переменную `DEPRECATED_GROUPS` по адресу `decort-sdk/tests/platform_upgrade/utils_url.go`.
2024-04-16 14:26:06 +03:00
Пример вывода:
```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
2025-12-08 16:16:35 +03:00
/cloudbroker/node/setMemAllocationRatio
2024-04-16 14:26:06 +03:00
/cloudbroker/image/computeciUnset
/cloudbroker/image/uploadImageFile
/cloudapi/account/getStats
/cloudapi/disks/fromPlatformDisk
2025-12-08 16:16:35 +03:00
/cloudbroker/node/getLogicalCoresCount
2024-04-16 14:26:06 +03:00
/cloudapi/lb/stop
/cloudapi/account/listVMs
/cloudapi/user/setData
/cloudapi/compute/createTemplateFromBlank
/cloudbroker/grid/removeCustomBackupPath
/cloudapi/user/getAudit
/cloudbroker/account/listCS
/cloudapi/account/listCS
2025-12-08 16:16:35 +03:00
/cloudbroker/node/setCpuAllocationRatio
2024-04-16 14:26:06 +03:00
/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
```