Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ ${API_ENDPOINT_URL} ${ENDPOINT_URL}/api/v1
${ADMIN_API_ENDPOINT_URL} ${API_ENDPOINT_URL}/containers
${UNHEALTHY_ENDPOINT_URL} ${API_ENDPOINT_URL}/containers/unhealthy
${NON_ADMIN_API_ENDPOINT_URL} ${API_ENDPOINT_URL}/clusterState
${VOLUME} vol1
${BUCKET} bucket1

*** Keywords ***
Check if Recon picks up container from OM
Expand Down Expand Up @@ -57,6 +59,21 @@ Check http return code
Should contain ${result} 200
END

Check if the listKeys api responds OK
[Arguments] ${volume} ${bucket}
${result} = Curl "${API_ENDPOINT_URL}/keys/listKeys?startPrefix=/${volume}/${bucket}&limit=1000"
Should contain ${result} "OK"
Should contain ${result} "keys"
Should contain ${result} "${volume}"
Should contain ${result} "${bucket}"

Curl
[Arguments] ${url}
${curl_command} = Set Variable curl -LSs ${url}
Run Keyword if '${SECURITY_ENABLED}' == 'true' Set Variable ${curl_command} curl --negotiate -u : -LSs ${url}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Set Variable returns the value, does not modify its first argument.

This can be fixed by using Set Variable If:

Suggested change
${curl_command} = Set Variable curl -LSs ${url}
Run Keyword if '${SECURITY_ENABLED}' == 'true' Set Variable ${curl_command} curl --negotiate -u : -LSs ${url}
${curl_command} = Set Variable If '${SECURITY_ENABLED}' == 'true' curl --negotiate -u : -LSs ${url} curl -LSs ${url}

But other test cases use curl --negotiate -u : unconditionally, so maybe we don't need the conditional logic at all.

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.

I added code to kinit and to use curl directly without any conditions. It should hopefully pass now; I checked out a separate branch with the same code and ran CI successfully on my fork (just for testing): https://github.com/siddhantsangwan/ozone/actions/runs/12157989638

${result} = Execute ${curl_command}
[Return] ${result}

*** Test Cases ***
Check if Recon picks up OM data
Execute ozone sh volume create recon
Expand Down Expand Up @@ -136,3 +153,13 @@ Check normal api access

kinit as non admin
Check http return code ${NON_ADMIN_API_ENDPOINT_URL} 200

Check listKeys api works
kinit as ozone admin
# Create volume and bucket
Execute ozone sh volume create ${VOLUME}
Execute ozone sh bucket create ${VOLUME}/${BUCKET}
Freon OCKG n=2 args=-s 10 -v ${VOLUME} -b ${BUCKET}

# Wait until Recon picks up the keys
Wait Until Keyword Succeeds 90sec 10sec Check if the listKeys api responds OK ${VOLUME} ${BUCKET}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks a lot @siddhantsangwan for adding the test. Unfortunately it fails with:

VOLUME_ALREADY_EXISTS Volume already exists

Instead of starting from scratch, we could add the listKeys request to existing test case Check if Recon picks up OM data, relying on the volume, bucket and keys created there.

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.

Thanks, I've the updated the PR with the suggested change.

Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public long getModificationTime() {
}

@JsonProperty("isKey")
public boolean isKey() {
public boolean getIsKey() {
return keyInfoProto.getIsFile();
}

Expand Down