From aa407ae7ab0200659f9aad12f5a60169cc7bc255 Mon Sep 17 00:00:00 2001 From: donoghuc Date: Fri, 6 Dec 2024 15:23:02 -0800 Subject: [PATCH] WIP: Double check understanding This commit contains an example for a clarifying question on: https://github.com/elastic/logstash/issues/16736 TODO: after confirming this is the approach, clean up commit msg --- ci/serverless/kibana_api_tests.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ci/serverless/kibana_api_tests.sh b/ci/serverless/kibana_api_tests.sh index 52f3f0f9b31..86e6f6df008 100755 --- a/ci/serverless/kibana_api_tests.sh +++ b/ci/serverless/kibana_api_tests.sh @@ -10,7 +10,7 @@ export EXIT_CODE="0" create_pipeline() { RESP_CODE=$(curl -s -w "%{http_code}" -o /dev/null -X PUT -H "Authorization: ApiKey $TESTER_API_KEY_ENCODED" "$KB_ENDPOINT/api/logstash/pipeline/$PIPELINE_NAME" \ - -H 'Content-Type: application/json' -H 'kbn-xsrf: logstash' \ + -H 'Content-Type: application/json' -H 'kbn-xsrf: logstash' -H 'x-elastic-product-origin: logstash' \ --data-binary @"$CURRENT_DIR/test_data/$PIPELINE_NAME.json") if [[ RESP_CODE -ge '400' ]]; then @@ -20,7 +20,8 @@ create_pipeline() { } get_pipeline() { - RESP_BODY=$(curl -s -X GET -H "Authorization: ApiKey $TESTER_API_KEY_ENCODED" "$KB_ENDPOINT/api/logstash/pipeline/$PIPELINE_NAME") + RESP_BODY=$(curl -s -X GET -H "Authorization: ApiKey $TESTER_API_KEY_ENCODED" -H 'x-elastic-product-origin: logstash' \ + "$KB_ENDPOINT/api/logstash/pipeline/$PIPELINE_NAME") \ SOURCE_BODY=$(cat "$CURRENT_DIR/test_data/$PIPELINE_NAME.json") RESP_PIPELINE_NAME=$(echo "$RESP_BODY" | jq -r '.id') @@ -41,7 +42,8 @@ get_pipeline() { } list_pipeline() { - RESP_BODY=$(curl -s -X GET -H "Authorization: ApiKey $TESTER_API_KEY_ENCODED" "$KB_ENDPOINT/api/logstash/pipelines" | jq --arg name "$PIPELINE_NAME" '.pipelines[] | select(.id==$name)' ) + RESP_BODY=$(curl -s -X GET -H "Authorization: ApiKey $TESTER_API_KEY_ENCODED" -H 'x-elastic-product-origin: logstash' \ + "$KB_ENDPOINT/api/logstash/pipelines" | jq --arg name "$PIPELINE_NAME" '.pipelines[] | select(.id==$name)' ) if [[ -z "$RESP_BODY" ]]; then EXIT_CODE=$(( EXIT_CODE + 1 )) echo "Fail to list pipeline." @@ -49,7 +51,8 @@ list_pipeline() { } delete_pipeline() { - RESP_CODE=$(curl -s -w "%{http_code}" -o /dev/null -X DELETE -H "Authorization: ApiKey $TESTER_API_KEY_ENCODED" "$KB_ENDPOINT/api/logstash/pipeline/$PIPELINE_NAME" \ + RESP_CODE=$(curl -s -w "%{http_code}" -o /dev/null -X DELETE -H "Authorization: ApiKey $TESTER_API_KEY_ENCODED" -H 'x-elastic-product-origin: logstash' \ + "$KB_ENDPOINT/api/logstash/pipeline/$PIPELINE_NAME" \ -H 'Content-Type: application/json' -H 'kbn-xsrf: logstash' \ --data-binary @"$CURRENT_DIR/test_data/$PIPELINE_NAME.json")