You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
decort-golang-sdk/tests/platform_upgrade
Алексей Фетисов e04dc42d2b
v1.10.0
2 months ago
..
.env.template v1.8.0 10 months ago
README.md v1.8.1 9 months ago
cloud_test.go v1.10.0 2 months ago
request_map.go v1.10.0 2 months ago
utils_get_list.go v1.8.1 9 months ago
utils_log.go v1.8.1 9 months ago
utils_requests.go v1.9.0 3 months ago
utils_urls.go v1.10.0 2 months ago

README.md

Авто тесты при переходе на новую версию платформы

Содержание

Подготовка к тестам

  1. Тесты находятся по директории decort-sdk/tests/platform_upgrade
  2. Внутри директории нужно создать и заполнить файл .env по аналогии с .env.template для доступа к платформе
  3. Внутри директории нужно создать и заполнить файл input.json, содержащий json с раздела POST /system/docgenerator/prepareCatalog (для получения json нажать кнопку Try it Out!) - требуется только для тестов запросов и тестов API методов

Примечание: тесты можно запускать напрямую методами среды разработки либо из командной строки из нужной директории, например командой go test -v -run <TestName>, где <TestName> - название запускаемого теста.

Примечание 2: все тесты, кроме TestGetAllPaths при первом запуске генерируют фал .log. При каждом последующем запуске результаты вывода сравниваются с файлом и в случае, если они одинаковы, то в консоль будет выведено All lines match the log file.. В противном случае будут выведены различающиеся строки.

Тесты Raw методов (Get, List)

Cloudapi

Запустить тест TestGetListCloudAPI в decort-sdk/tests/platform_upgrade/cloud_test.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 задумано специально), завести и исправить ошибку.

Пример вывода:

=== 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 задумано специально), завести и исправить ошибку.

Пример вывода:

=== 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.

Пример вывода:

=== 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