-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(CLOUDDEV-432): added new format for test #132
base: master
Are you sure you want to change the base?
Conversation
Test Results8 tests 7 ✅ 6m 42s ⏱️ For more details on these failures, see this check. Results for commit 2247cc6. ♻️ This comment has been updated with latest results. |
eda72ed
to
f6075ed
Compare
f6075ed
to
c8c54a9
Compare
|
||
- name: Tests data_source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Старую версию сразу убирать не надо. Будем постепенно убирать то, что добавили в новой версии тестов
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так же прошу сейчас добавить динамическое создание/удаление проектов для старых тестов
tfSecGOpts terraform.Options | ||
) | ||
|
||
func TestMain(m *testing.M) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сейчас подумал, что при таком подходе мы лишаемся возможности локально запускать отдельные тесты. Попробуй реализовать через подход once.Do (https://golang.hotexamples.com/examples/sync/Once/Do/golang-once-do-method-examples.html)Добавив вызов функции подготовки окружения в каждый тест. Тогда функция подготовки окружения будет вызвана один раз (что сэкономит время), при этом будет возможность локального запуска отдельных тестов. В таком случае функциюTestCreatePrepareResourcesForTerraformEdgeCenterInstance нужно будет переименовать в PrepareResourcesForTerraformEdgeCenterInstance
// Инициализация и применение конфигурации сетевого модуля. | ||
initializeNetworkModule(&tfNetOpts) | ||
applyModule(t, &tfNetOpts, "network") | ||
// Получение и сохранение идентификаторов сети и подсети. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Комменты в коде лучше все-таки на английском сделать
defer os.Exit(code) | ||
} | ||
|
||
func TestCreatePrepareResourcesForTerraformEdgeCenterInstance(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется, что слово Create в названии лишнее
|
||
func TestCreatePrepareResourcesForTerraformEdgeCenterInstance(t *testing.T) { | ||
// Инициализация и применение конфигурации сетевого модуля. | ||
initializeNetworkModule(&tfNetOpts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В данных функциях, на мой взгляд, больше подходят названия типа "initializeNetworkTfOpts"
if err != nil { | ||
t.Fatalf("failed to get output %s: %v", key, err) | ||
} | ||
require.Equal(t, expectedValue, output, fmt.Sprintf("%s should be updated to the new value", key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не обязательно updated
return | ||
} | ||
|
||
fmt.Println(project.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Чуть дополнить вывод fmt.Sprintf("Created project ID: %d", project.ID)
|
||
fmt.Printf("Статус ответа: %s\n", resp.Status) | ||
fmt.Printf("Тело ответа: %s\n", string(body)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хорошо бы вывести сообщение что проект с таким-то ID успешно удален
return | ||
} | ||
|
||
baseURL := fmt.Sprintf("https://api.edgecenter.online/cloud/v1/projects/%s", projectID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хостнейм лучше бы вывести в переменную среды, чтобы можно было запускать в разных окружениях
} | ||
|
||
func main() { | ||
baseURL := "https://api.edgecenter.online/cloud/v1/projects" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хостнейм лучше бы вывести в переменную среды, чтобы можно было запускать в разных окружениях
No description provided.