Skip to content

Test/rest list objects v2 queries#2013

Open
lrm25 wants to merge 1 commit intomainfrom
test/rest_list_objects_v2_queries
Open

Test/rest list objects v2 queries#2013
lrm25 wants to merge 1 commit intomainfrom
test/rest_list_objects_v2_queries

Conversation

@lrm25
Copy link
Copy Markdown
Contributor

@lrm25 lrm25 commented Apr 3, 2026

No description provided.

@lrm25 lrm25 force-pushed the test/rest_list_objects_v2_queries branch 5 times, most recently from 04d63da to 41f4721 Compare April 10, 2026 15:38
@lrm25 lrm25 force-pushed the test/rest_list_objects_v2_queries branch 2 times, most recently from 0d25058 to 35e2399 Compare April 13, 2026 19:30
bucket_list=$(xmllint --xpath '//*[local-name()="Bucket"]/*[local-name()="Name"]/text()' "$1")
local response
if ! response=$(xmllint --xpath '//*[local-name()="Bucket"]/*[local-name()="Name"]/text()' "$1" 2>&1); then
if [[ "$response" == *"XPath set is empty" ]]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xmllint often appends a newline or specific formatting to its error messages. Using a wildcard at the beginning of the check—or checking the exit status directly—makes it more bulletproof
if [[ "$response" == *"XPath set is empty"* ]]; then


local response error
if ! response=$(check_count_and_keys "$1" "$3" "${@:5}" 2>&1); then
log 2 "error checking count and keys: $xml_file"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xml_file hasn't been defined here, it happens after this if block.


xml_data="$response"
if ! check_if_element_exists "$xml_data" "$2" "ListBucketResult" "StartAfter"; then
log 2 "error checking if element '$key' exists"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key isn't defined here, probably mean $2?

}

list_objects_delimiter() {
run assert_param_count "ListObjects version" 1 $#
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is all using run/assert - but that should be done at the test level, not in the helpers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a common call for two tests with just a version change, can move it though

fi
status_line_idx=1
status_code=""
continue_count=0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local vars?

return 1
fi
if check_if_element_exists "$1" "$2" "${@:3}"; then
log 2 "element '$2' should not exist in data (data: $(cat "$1"))"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a risk here is the file is really big this log line could be really bloated.

@lrm25 lrm25 force-pushed the test/rest_list_objects_v2_queries branch from 9d1f4c7 to a53e9a1 Compare April 13, 2026 22:16
@lrm25 lrm25 force-pushed the test/rest_list_objects_v2_queries branch from a53e9a1 to 1632c8c Compare April 14, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants