This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 0a0e773bafe HDDS-17633. Improve snapshot compatibility test (#11883)
0a0e773bafe is described below
commit 0a0e773bafe902a8e4aa733dfbec425993696295
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Tue Nov 3 16:00:15 2026 +0100
HDDS-17633. Improve snapshot compatibility test (#11883)
---
.../src/main/smoketest/compatibility/read.robot | 42 +++++-
.../src/main/smoketest/compatibility/write.robot | 168 +++++++--------------
.../dist/src/main/smoketest/snapshot/lib.resource | 46 ++++++
3 files changed, 136 insertions(+), 120 deletions(-)
diff --git a/hadoop-ozone/dist/src/main/smoketest/compatibility/read.robot
b/hadoop-ozone/dist/src/main/smoketest/compatibility/read.robot
index 406b19fbe4c..b7c29c55a50 100644
--- a/hadoop-ozone/dist/src/main/smoketest/compatibility/read.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/compatibility/read.robot
@@ -16,10 +16,20 @@
*** Settings ***
Documentation Read Compatibility
Resource ../ozone-lib/shell.robot
+Resource ../snapshot/lib.resource
Resource setup.robot
Test Timeout 5 minutes
+*** Variables ***
+${FSO_BUCKET} vol1/fso-bucket-${DATA_VERSION}
+${SNAPSHOT1} snapshot-1-${DATA_VERSION}
+${SNAPSHOT2} snapshot-2-${DATA_VERSION}
+${SNAPSHOT3} snapshot-3-${DATA_VERSION}
+${SNAPSHOT_KEY1} snapdiff-key1-${DATA_VERSION}
+${SNAPSHOT_KEY2} snapdiff-key2-${DATA_VERSION}
+
+
*** Keywords ***
Key List With Replication
[arguments] ${args}
@@ -148,19 +158,19 @@ FSO Bucket Can Be Read
Pass Execution If '${DATA_VERSION}' < '${FSO_VERSION}' Skipped
write test case
Pass Execution If '${CLIENT_VERSION}' < '${FSO_VERSION}' Client does
not support FSO
Pass Execution If '${CLUSTER_VERSION}' < '${FSO_VERSION}' Cluster
does not support FSO
- File Should Match Local File
ofs://om/vol1/fso-bucket-${DATA_VERSION}/dir/subdir/file ${TESTFILE}
+ File Should Match Local File ofs://om/${FSO_BUCKET}/dir/subdir/file
${TESTFILE}
HSync Lease Recover Can Be Used
Pass Execution If '${DATA_VERSION}' < '${FSO_VERSION}' Skipped
write test case
Pass Execution If '${CLIENT_VERSION}' < '${HSYNC_VERSION}' Client
does not support HSYNC
Pass Execution If '${CLUSTER_VERSION}' < '${HSYNC_VERSION}' Cluster
does not support HSYNC
- Execute ozone admin om lease recover
--path=ofs://om/vol1/fso-bucket-${DATA_VERSION}/dir/subdir/file
+ Execute ozone admin om lease recover
--path=ofs://om/${FSO_BUCKET}/dir/subdir/file
Key Info File Flag Should Be Set Correctly
Pass Execution If '${CLUSTER_VERSION}' <= '${EC_VERSION}' Cluster
does not support 'file' flag
Pass Execution If '${CLIENT_VERSION}' <= '${EC_VERSION}' Client does
not support 'file' flag
- ${dirpath} = Set Variable
/vol1/fso-bucket-${DATA_VERSION}/dir/subdir/
+ ${dirpath} = Set Variable /${FSO_BUCKET}/dir/subdir/
${filepath} = Set Variable ${dirpath}file
${key_info} = Execute ozone sh key info ${filepath}
@@ -168,3 +178,29 @@ Key Info File Flag Should Be Set Correctly
${dir_info} = Execute ozone sh key info ${dirpath}
Should Contain ${dir_info} \"file\" : false
+
+Snapshots Can Be Diffed
+ Pass Execution If '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'
Cluster does not support snapshots
+ Pass Execution If '${CLIENT_VERSION}' < '${SNAPSHOT_VERSION}' Client
does not support snapshots
+ Pass Execution If '${CLIENT_VERSION}' >=
'${SNAPSHOT_DIFF_SUBMIT_VERSION}' Tested elsewhere with --get-report
+ Pass Execution If '${DATA_VERSION}' < '${SNAPSHOT_VERSION}' Skipped
write test case
+
+ # old client does not support --get-report
+ # The snapshot diff command should return the report, submitting a job if
necessary.
+ ${output} = Wait For Snapshot diff ${FSO_BUCKET} ${SNAPSHOT1}
${SNAPSHOT2} ${SNAPSHOT_KEY1}
+ # Legacy Snapshot Diff Report Omits Dependency Metadata
+ Should Not Contain ${output} Report is dependency
+
+Can --get-report of Snapshot Diff
+ Pass Execution If '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'
Cluster does not support snapshots
+ Pass Execution If '${CLIENT_VERSION}' <
'${SNAPSHOT_DIFF_SUBMIT_VERSION}' Client does not support snapshot diff
--get-report
+ Pass Execution If '${DATA_VERSION}' < '${SNAPSHOT_VERSION}' Skipped
write test case
+
+ Wait For Snapshot diff --get-report ${FSO_BUCKET} ${SNAPSHOT1}
${SNAPSHOT2} ${SNAPSHOT_KEY1}
+
+Can --get-report of --ordered Snapshot Diff
+ Pass Execution If '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'
Cluster does not support snapshots
+ Pass Execution If '${CLIENT_VERSION}' <
'${SNAPSHOT_DIFF_SUBMIT_VERSION}' Client does not support snapshot diff
--get-report
+ Pass Execution If '${DATA_VERSION}' <
'${SNAPSHOT_DIFF_ORDERED_VERSION}' Skipped write test case
+
+ Wait For Snapshot diff --get-report ${FSO_BUCKET} ${SNAPSHOT1}
${SNAPSHOT3} ${SNAPSHOT_KEY1} ${SNAPSHOT_KEY2}
diff --git a/hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot
b/hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot
index 126f352079d..4d3b1fad1cc 100644
--- a/hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot
@@ -23,6 +23,22 @@ Test Timeout 5 minutes
*** Variables ***
${ENCRYPTION_KEY} key1
+${FSO_BUCKET} vol1/fso-bucket-${CLIENT_VERSION}
+${SNAPSHOT1} snapshot-1-${CLIENT_VERSION}
+${SNAPSHOT2} snapshot-2-${CLIENT_VERSION}
+${SNAPSHOT3} snapshot-3-${CLIENT_VERSION}
+${SNAPSHOT_KEY1} snapdiff-key1-${CLIENT_VERSION}
+${SNAPSHOT_KEY2} snapdiff-key2-${CLIENT_VERSION}
+
+
+*** Keywords ***
+Expected Snapshot Diff Output
+ IF '${CLUSTER_VERSION}' < '${SNAPSHOT_DIFF_SUBMIT_VERSION}' or
'${CLIENT_VERSION}' < '${SNAPSHOT_DIFF_SUBMIT_VERSION}'
+ RETURN Snapshot diff job is IN_PROGRESS
+ ELSE
+ RETURN Submitting a new job
+ END
+
*** Test Cases ***
@@ -68,9 +84,9 @@ File Can Be Deleted
FSO Bucket Can Be Created and Used
Pass Execution If '${CLIENT_VERSION}' < '${FSO_VERSION}' Client does
not support FSO
Pass Execution If '${CLUSTER_VERSION}' < '${FSO_VERSION}' Cluster
does not support FSO
- Execute ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED
/vol1/fso-bucket-${CLIENT_VERSION}
- Execute ozone fs -mkdir -p
ofs://om/vol1/fso-bucket-${CLIENT_VERSION}/dir/subdir
- Execute ozone fs -put ${TESTFILE}
ofs://om/vol1/fso-bucket-${CLIENT_VERSION}/dir/subdir/file
+ Execute ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED
${FSO_BUCKET}
+ Execute ozone fs -mkdir -p ofs://om/${FSO_BUCKET}/dir/subdir
+ Execute ozone fs -put ${TESTFILE} ofs://om/${FSO_BUCKET}/dir/subdir/file
HSync Can Be Used To Create Keys
Pass Execution If '${CLIENT_VERSION}' < '${HSYNC_VERSION}' Client
does not support HSYNC
@@ -80,119 +96,37 @@ HSync Can Be Used To Create Keys
${pfspath} = Format FS URL ofs $vol1 bucket1
Freon DFSG sync=HSYNC n=1 path=${pfspath}
-Snapshot Diff RPC Is Compatible
- # Snapshot diff requires snapshot support in these tests.
- Pass Execution If '${CLIENT_VERSION}' < '${SNAPSHOT_VERSION}'
Snapshot CLI not supported by this client
- Pass Execution If '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'
Snapshot CLI not supported by this client
-
- ${bucket} = Set Variable snapdiff-${CLIENT_VERSION}
- ${fromSnap} = Set Variable snapdiff-from-${CLIENT_VERSION}
- ${toSnap} = Set Variable snapdiff-to-${CLIENT_VERSION}
- ${key1} = Set Variable snapdiff-key1-${CLIENT_VERSION}
- ${key2} = Set Variable snapdiff-key2-${CLIENT_VERSION}
-
- Execute ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED
/vol1/${bucket}
- Execute ozone sh key put /vol1/${bucket}/base ${TESTFILE}
- Execute ozone sh snapshot create /vol1/${bucket} ${fromSnap}
- Execute ozone sh key put /vol1/${bucket}/${key1} ${TESTFILE}
- Execute ozone sh key put /vol1/${bucket}/${key2} ${TESTFILE}
- Execute ozone sh snapshot create /vol1/${bucket} ${toSnap}
-
- Snapshot Diff Report Should Contain Created Keys
- ... /vol1/${bucket} ${fromSnap} ${toSnap} ${key1} ${key2}
-
-Snapshot Diff Ordered Submit Is Compatible
- Pass Execution If '${CLIENT_VERSION}' <
'${SNAPSHOT_DIFF_ORDERED_VERSION}' Client does not support --ordered
- Pass Execution If '${CLIENT_VERSION}' < '${SNAPSHOT_VERSION}'
Snapshot CLI not supported by this client
- Pass Execution If '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'
Snapshot CLI not supported by this cluster
- Pass Execution If '${CLUSTER_VERSION}' <
'${SNAPSHOT_DIFF_SUBMIT_VERSION}' Cluster does not support snapshot diff
submit
-
- ${bucket} = Set Variable snapdiff-ordered-${CLIENT_VERSION}
- ${fromSnap} = Set Variable snapdiff-ordered-from-${CLIENT_VERSION}
- ${toSnap} = Set Variable snapdiff-ordered-to-${CLIENT_VERSION}
- ${key1} = Set Variable snapdiff-ordered-key1-${CLIENT_VERSION}
-
- Execute ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED
/vol1/${bucket}
- Execute ozone sh key put /vol1/${bucket}/base ${TESTFILE}
- Execute ozone sh snapshot create /vol1/${bucket} ${fromSnap}
- Execute ozone sh key put /vol1/${bucket}/${key1} ${TESTFILE}
- Execute ozone sh snapshot create /vol1/${bucket} ${toSnap}
-
- ${submitOutput} = Execute ozone sh snapshot diff --ordered
/vol1/${bucket} ${fromSnap} ${toSnap}
- Should Contain ${submitOutput} Submitting a new job
- Wait Until Keyword Succeeds 2min 5sec
- ... Snapshot Diff Command Should Contain Created Keys
- ... ozone sh snapshot diff --get-report /vol1/${bucket} ${fromSnap}
${toSnap}
- ... ${fromSnap} ${toSnap} ${key1} ${key1}
-
-Snapshot Diff Legacy Client Ignores Ordered Report Metadata
- Pass Execution If '${CLIENT_VERSION}' >=
'${SNAPSHOT_DIFF_SUBMIT_VERSION}' Client uses submit path
- Pass Execution If '${CLIENT_VERSION}' < '${SNAPSHOT_VERSION}'
Snapshot CLI not supported by this client
- Pass Execution If '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'
Snapshot CLI not supported by this client
-
- ${bucket} = Set Variable snapdiff-legacy-${CLIENT_VERSION}
- ${fromSnap} = Set Variable snapdiff-legacy-from-${CLIENT_VERSION}
- ${toSnap} = Set Variable snapdiff-legacy-to-${CLIENT_VERSION}
- ${key1} = Set Variable snapdiff-legacy-key1-${CLIENT_VERSION}
-
- Execute ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED
/vol1/${bucket}
- Execute ozone sh key put /vol1/${bucket}/base ${TESTFILE}
- Execute ozone sh snapshot create /vol1/${bucket} ${fromSnap}
- Execute ozone sh key put /vol1/${bucket}/${key1} ${TESTFILE}
- Execute ozone sh snapshot create /vol1/${bucket} ${toSnap}
-
- Wait Until Keyword Succeeds 2min 5sec
- ... Legacy Snapshot Diff Report Omits Dependency Metadata
- ... ozone sh snapshot diff /vol1/${bucket} ${fromSnap} ${toSnap}
- ... ${fromSnap} ${toSnap} ${key1}
+Snapshot Can Be Created
+ Pass Execution If '${CLIENT_VERSION}' < '${SNAPSHOT_VERSION}' Client
does not support snapshots
+ Pass Execution If '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'
Cluster does not support snapshots
-*** Keywords ***
-Snapshot Diff Report Should Contain Created Keys
- [Arguments] ${bucketPath} ${fromSnap} ${toSnap} ${key1}
${key2}
-
- # New clients support --get-report. Old clients don't; fall back to the
legacy call.
- ${status} ${output} = Run Keyword And Ignore Error
- ... Execute ozone sh snapshot diff --get-report ${bucketPath}
${fromSnap} ${toSnap}
-
- IF '${status}' == 'PASS'
- # On newer servers, --get-report does not submit jobs. If the job is
not
- # found, submit it first (this keeps new-client/new-server behavior).
- ${notFound} = Run Keyword And Return Status
- ... Should Contain ${output} No snapshot diff job found
- IF ${notFound}
- ${output} = Execute ozone sh snapshot diff ${bucketPath}
${fromSnap} ${toSnap}
- Should Contain ${output} Submitting a new job
- ELSE
- # On older servers, --get-report falls back to the legacy snapshot
diff command.
- # Ensure the submit path succeeds without failing the test.
- ${submitStatus} ${submitOutput} = Run Keyword And Ignore
Error
- ... Execute ozone sh snapshot diff ${bucketPath} ${fromSnap}
${toSnap}
- Run Keyword If '${submitStatus}' == 'FAIL'
- ... Fail Snapshot diff submit failed: ${submitOutput}
- END
- Wait Until Keyword Succeeds 2min 5sec
- ... Snapshot Diff Command Should Contain Created Keys
- ... ozone sh snapshot diff --get-report ${bucketPath} ${fromSnap}
${toSnap}
- ... ${fromSnap} ${toSnap} ${key1} ${key2}
- ELSE
- # old client, which does not support --get-report.
- # The snapshot diff command should return the report, submitting a job
if necessary.
- Wait Until Keyword Succeeds 2min 5sec
- ... Snapshot Diff Command Should Contain Created Keys
- ... ozone sh snapshot diff ${bucketPath} ${fromSnap} ${toSnap}
- ... ${fromSnap} ${toSnap} ${key1} ${key2}
- END
+ Execute ozone sh snapshot create ${FSO_BUCKET} ${SNAPSHOT1}
+ Execute ozone sh key put ${FSO_BUCKET}/${SNAPSHOT_KEY1}
${TESTFILE}
+ Execute ozone sh snapshot create ${FSO_BUCKET} ${SNAPSHOT2}
+ Execute ozone sh key put ${FSO_BUCKET}/${SNAPSHOT_KEY2}
${TESTFILE}
+ Execute ozone sh snapshot create ${FSO_BUCKET} ${SNAPSHOT3}
+
+Snapshot Diff Can Be Requested
+ Pass Execution If '${CLIENT_VERSION}' < '${SNAPSHOT_VERSION}' Client
does not support snapshots
+ Pass Execution If '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'
Cluster does not support snapshots
+
+ ${output} = Execute ozone sh snapshot diff ${FSO_BUCKET}
${SNAPSHOT1} ${SNAPSHOT2}
+ ${expected} = Expected Snapshot Diff Output
+ Should Contain ${output} ${expected}
+
+Snapshot Diff --get-report Submits Job On Old Cluster
+ Pass Execution If '${CLIENT_VERSION}' <
'${SNAPSHOT_DIFF_SUBMIT_VERSION}' Client does not support snapshot diff
submit
+ Pass Execution If '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'
Cluster does not support snapshots
+ Pass Execution If '${CLUSTER_VERSION}' >=
'${SNAPSHOT_DIFF_SUBMIT_VERSION}' Cluster supports snapshot diff submit, no
fallback
+
+ ${output} = Execute ozone sh snapshot diff --get-report
${FSO_BUCKET} ${SNAPSHOT2} ${SNAPSHOT3}
+ ${expected} = Expected Snapshot Diff Output
+ Should Contain ${output} ${expected}
+
+Snapshot Diff Can Be --ordered
+ Pass Execution If '${CLIENT_VERSION}' <
'${SNAPSHOT_DIFF_ORDERED_VERSION}' Client does not support ordered snapshots
+ Pass Execution If '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'
Cluster does not support snapshots
-Snapshot Diff Command Should Contain Created Keys
- [Arguments] ${command} ${fromSnap} ${toSnap} ${key1} ${key2}
- ${output} = Execute ${command}
- Should Contain ${output} Difference between snapshot: ${fromSnap}
and snapshot: ${toSnap}
- Should Contain ${output} ${key1}
- Should Contain ${output} ${key2}
-
-Legacy Snapshot Diff Report Omits Dependency Metadata
- [Arguments] ${command} ${fromSnap} ${toSnap} ${key1}
- ${output} = Execute ${command}
- Should Contain ${output} Difference between snapshot: ${fromSnap}
and snapshot: ${toSnap}
- Should Contain ${output} ${key1}
- Should Not Contain ${output} Report is dependency
+ ${output} = Execute ozone sh snapshot diff --ordered ${FSO_BUCKET}
${SNAPSHOT1} ${SNAPSHOT3}
+ ${expected} = Expected Snapshot Diff Output
+ Should Contain ${output} ${expected}
diff --git a/hadoop-ozone/dist/src/main/smoketest/snapshot/lib.resource
b/hadoop-ozone/dist/src/main/smoketest/snapshot/lib.resource
new file mode 100644
index 00000000000..615e8f99944
--- /dev/null
+++ b/hadoop-ozone/dist/src/main/smoketest/snapshot/lib.resource
@@ -0,0 +1,46 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation Snapshot Keywords
+Library BuiltIn
+Library OperatingSystem
+Resource ../lib/os.robot
+
+
+*** Keywords ***
+Wait For Snapshot ${command}
+ [arguments] ${bucket} ${fromSnap} ${toSnap} @{keys}
+
+ ${output} = Wait Until Keyword Succeeds 2min 5sec
+ ... Snapshot Diff Response Should Contain Created Keys
+ ... ozone sh snapshot ${command} ${bucket}
${fromSnap} ${toSnap}
+ ... ${fromSnap} ${toSnap} @{keys}
+
+ [return] ${output}
+
+
+Snapshot Diff Response Should Contain Created Keys
+ [arguments] ${command} ${fromSnap} ${toSnap} @{keys}
+
+ ${output} = Execute ${command}
+
+ Should Contain ${output} Difference between snapshot: ${fromSnap}
and snapshot: ${toSnap}
+
+ FOR ${key} IN @{keys}
+ Should Contain ${output} ${key}
+ END
+
+ [return] ${output}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]