Я пытаюсь использовать октановые API, чтобы получить некоторую информацию из Octane (инструмент управления тестами) в моем трубопроводе Jenkins. По -видимому, существует проблема с объектами в URL -адреса, из -за которой я вижу следующую ошибку (в браузере). < /P>
{"error_code":"platform.unknown_field","correlation_id":"xxxxxx","description":"The entity type 'test_suite_link_to_manual' does not have a field/s by name/s 'manual_test'","description_translated":"The entity type 'test_suite_link_to_manual' does not have a field/s by name/s 'manual_test'","properties":{"entity_type":"test_suite_link_to_manual","field_name":"manual_test"},"business_error":true}
То же самое в отличном сценарии конвейера возвращает java.io.IOException: сервер вернул код ответа HTTP: 400 для URL: и ничего помимо этого. Я хотел бы зарегистрировать сообщение, которое я получаю от браузера. Вот часть кода
def connection = new URL(url).openConnection()
try {
attempt++
if (!isCookieValid(3)) {
cookie = getCookie(3)
}
connection.setRequestMethod("GET")
connection.setRequestProperty("Cookie", cookie)
connection.connect()
echo connection.inputStream.text
def responseCode = connection.responseCode
if (responseCode == 200) {
echo "Test suite link to manual tests retrieved successfully"
return connection.inputStream.text
} else {
def errorMessage = new StringBuilder()
if (connection.errorStream != null) {
def reader = new BufferedReader(new InputStreamReader(connection.errorStream))
def line
while ((line = reader.readLine()) != null) {
errorMessage.append(line).append("\n")
}
reader.close()
echo "Bus error" + errorMessage.toString()
}
}
} catch (Exception e) {
def errorMessage = new StringBuilder()
if (connection.errorStream != null) {
def reader = new BufferedReader(new InputStreamReader(connection.errorStream))
def line
while ((line = reader.readLine()) != null) {
errorMessage.append(line).append("\n")
}
reader.close()
echo "Bus error catch " + e + e.message + errorMessage.toString()
}
if (attempt == retries) {
echo "Failed to get test suites link to manual tests after ${retries} attempts"
return null
}
echo "Attempt ${attempt} failed: ${e}. Retrying..."
sleep(5) // Wait for 5 seconds before retrying
}
О/П, который я получаю в консоли Дженкинса
Bus error catch java.io.IOException: Server returned HTTP response code: 400 for URL: https://dummy/api/test_suite_link_to_ma ... test_suite EQ {id IN 1010101}"Server returned HTTP response code: 400 for URL: https://dummy/api/test_suite_link_to_ma ... test_suite EQ {id IN 1010101}"
400 Bad Request
400 Bad Request
nginx/1.21.5
Подробнее здесь: https://stackoverflow.com/questions/793 ... roovy-pipe
Не в состоянии увидеть фактическую бизнес -ошибку во время ошибки API в Jenkins Groovy Pipely с использованием OpenConce ⇐ JAVA
Программисты JAVA общаются здесь
1737888529
Anonymous
Я пытаюсь использовать октановые API, чтобы получить некоторую информацию из Octane (инструмент управления тестами) в моем трубопроводе Jenkins. По -видимому, существует проблема с объектами в URL -адреса, из -за которой я вижу следующую ошибку (в браузере). < /P>
{"error_code":"platform.unknown_field","correlation_id":"xxxxxx","description":"The entity type 'test_suite_link_to_manual' does not have a field/s by name/s 'manual_test'","description_translated":"The entity type 'test_suite_link_to_manual' does not have a field/s by name/s 'manual_test'","properties":{"entity_type":"test_suite_link_to_manual","field_name":"manual_test"},"business_error":true}
То же самое в отличном сценарии конвейера возвращает [b]java.io.IOException: сервер вернул код ответа HTTP: 400 для URL:[/b] и ничего помимо этого. Я хотел бы зарегистрировать сообщение, которое я получаю от браузера. Вот часть кода
def connection = new URL(url).openConnection()
try {
attempt++
if (!isCookieValid(3)) {
cookie = getCookie(3)
}
connection.setRequestMethod("GET")
connection.setRequestProperty("Cookie", cookie)
connection.connect()
echo connection.inputStream.text
def responseCode = connection.responseCode
if (responseCode == 200) {
echo "Test suite link to manual tests retrieved successfully"
return connection.inputStream.text
} else {
def errorMessage = new StringBuilder()
if (connection.errorStream != null) {
def reader = new BufferedReader(new InputStreamReader(connection.errorStream))
def line
while ((line = reader.readLine()) != null) {
errorMessage.append(line).append("\n")
}
reader.close()
echo "Bus error" + errorMessage.toString()
}
}
} catch (Exception e) {
def errorMessage = new StringBuilder()
if (connection.errorStream != null) {
def reader = new BufferedReader(new InputStreamReader(connection.errorStream))
def line
while ((line = reader.readLine()) != null) {
errorMessage.append(line).append("\n")
}
reader.close()
echo "Bus error catch " + e + e.message + errorMessage.toString()
}
if (attempt == retries) {
echo "Failed to get test suites link to manual tests after ${retries} attempts"
return null
}
echo "Attempt ${attempt} failed: ${e}. Retrying..."
sleep(5) // Wait for 5 seconds before retrying
}
О/П, который я получаю в консоли Дженкинса
Bus error catch java.io.IOException: Server returned HTTP response code: 400 for URL: https://dummy/api/test_suite_link_to_manual_tests?fields=id,test_suite,manual_test,test_suite&query="test_suite EQ {id IN 1010101}"Server returned HTTP response code: 400 for URL: https://dummy/api/test_suite_link_to_manual_tests?fields=id,test_suite,manual_test,test_suite&query="test_suite EQ {id IN 1010101}"
400 Bad Request
400 Bad Request
nginx/1.21.5
Подробнее здесь: [url]https://stackoverflow.com/questions/79386348/not-able-to-see-actual-business-error-during-an-api-error-in-jenkins-groovy-pipe[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия