From dbbd84a64aaa2245e5bfed2fccf126f6bae42e6c Mon Sep 17 00:00:00 2001 From: Siddhant Sangwan Date: Tue, 3 Dec 2024 15:50:59 +0530 Subject: [PATCH 1/4] HDDS-11848. Serialisation bug in Recon's listKeys API --- .../hadoop/ozone/recon/api/types/KeyEntityInfoProtoWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/KeyEntityInfoProtoWrapper.java b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/KeyEntityInfoProtoWrapper.java index b61ebf9963e3..890f8fbd3aa9 100644 --- a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/KeyEntityInfoProtoWrapper.java +++ b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/KeyEntityInfoProtoWrapper.java @@ -122,7 +122,7 @@ public long getModificationTime() { } @JsonProperty("isKey") - public boolean isKey() { + public boolean getIsKey() { return keyInfoProto.getIsFile(); } From abd70ba58a18d68d2f80eefb77c6343dd86d6d40 Mon Sep 17 00:00:00 2001 From: Siddhant Sangwan Date: Tue, 3 Dec 2024 20:21:54 +0530 Subject: [PATCH 2/4] add a robot test case for checking the listKeys api --- .../src/main/smoketest/recon/recon-api.robot | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot b/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot index 43860b75d996..3dfd0fe587e8 100644 --- a/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot +++ b/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot @@ -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 @@ -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} + ${result} = Execute ${curl_command} + [Return] ${result} + *** Test Cases *** Check if Recon picks up OM data Execute ozone sh volume create recon @@ -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} \ No newline at end of file From 29ad408c08851e603e481cabd67a54e8a94b714b Mon Sep 17 00:00:00 2001 From: Siddhant Sangwan Date: Wed, 4 Dec 2024 11:16:25 +0530 Subject: [PATCH 3/4] add listKeys api check to existing test case --- .../dist/src/main/smoketest/recon/recon-api.robot | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot b/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot index 3dfd0fe587e8..22faea9026f2 100644 --- a/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot +++ b/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot @@ -84,6 +84,7 @@ Check if Recon picks up OM data Execute ozone sh bucket create recon/api --layout=LEGACY Freon OCKG n=10 args=-s 1025 -v recon -b api Wait Until Keyword Succeeds 90sec 10sec Check if Recon picks up container from OM + Wait Until Keyword Succeeds 90sec 10sec Check if the listKeys api responds OK recon api Check if Recon picks up DN heartbeats ${result} = Execute curl --negotiate -u : -LSs ${API_ENDPOINT_URL}/datanodes @@ -153,13 +154,3 @@ 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} \ No newline at end of file From 5034a4b7efbb8b6bb247d7fada7a661e65614e52 Mon Sep 17 00:00:00 2001 From: Siddhant Sangwan Date: Wed, 4 Dec 2024 12:38:11 +0530 Subject: [PATCH 4/4] add authentication --- .../dist/src/main/smoketest/recon/recon-api.robot | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot b/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot index 22faea9026f2..883e93bdc5c1 100644 --- a/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot +++ b/hadoop-ozone/dist/src/main/smoketest/recon/recon-api.robot @@ -61,19 +61,13 @@ Check http return code Check if the listKeys api responds OK [Arguments] ${volume} ${bucket} - ${result} = Curl "${API_ENDPOINT_URL}/keys/listKeys?startPrefix=/${volume}/${bucket}&limit=1000" + Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit as ozone admin + ${result} = Execute curl --negotiate -u : -LSs ${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} - ${result} = Execute ${curl_command} - [Return] ${result} - *** Test Cases *** Check if Recon picks up OM data Execute ozone sh volume create recon