Не в состоянии увидеть фактическую бизнес -ошибку во время ошибки API в Jenkins Groovy Pipely с использованием OpenConceJAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Не в состоянии увидеть фактическую бизнес -ошибку во время ошибки API в Jenkins Groovy Pipely с использованием OpenConce

Сообщение 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}
То же самое в отличном сценарии конвейера возвращает 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
}

o/p Я получаю в консоли Дженкинса
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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»