Skip to content

Commit

Permalink
Added upgrade tests for hsync
Browse files Browse the repository at this point in the history
  • Loading branch information
hemantk-12 committed Aug 20, 2024
1 parent 88b88ff commit c059858
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hadoop-ozone/dist/src/main/compose/ozone/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ execute_robot_test scm -v SCHEME:o3fs -v BUCKET_TYPE:bucket -N ozonefs-o3fs-buck
execute_robot_test s3g grpc/grpc-om-s3-metrics.robot

execute_robot_test scm --exclude pre-finalized-snapshot-tests snapshot

execute_robot_test scm --exclude pre-finalized-hsync-tests hsync/upgrade-hsync-check.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# 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.

source "$TEST_DIR"/testlib.sh

with_this_version_pre_finalized() {
# New layout features were added in this version, so OM and SCM should be
# pre-finalized.
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-check-finalization" --include pre-finalized upgrade/check-finalization.robot
# Test that EC is disabled when pre-finalized.
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-hsync" --include pre-finalized-hsync-tests hsync/upgrade-hsync-check.robot
}

with_this_version_finalized() {
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-hsync" --include post-finalized-hsync-tests hsync/upgrade-hsync-check.robot
}
62 changes: 62 additions & 0 deletions hadoop-ozone/dist/src/main/smoketest/hsync/hsync-setup.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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 Test setup for HSync.
Library OperatingSystem
Library String
Library BuiltIn
Resource ../commonlib.robot

*** Variables ***
${VOLUME}
${BUCKET}
${KEY_ONE}
${KEY_TWO}

*** Keywords ***
Create volume
${random} = Generate Random String 5 [LOWER]
${volume} = Set Variable vol-${random}
${result} = Execute ozone sh volume create /${volume}
Should not contain ${result} Failed
[Return] ${volume}

Create bucket
[Arguments] ${volume} ${bucket_layout}
${random} = Generate Random String 5 [LOWER]
${bucket} = Set Variable buc-${random}
${result} = Execute ozone sh bucket create -l ${bucket_layout} /${volume}/${bucket}
Should not contain ${result} Failed
[Return] ${bucket}

Create key
[Arguments] ${volume} ${bucket} ${file}
${random} = Generate Random String 5 [LOWER]
${key} = Set Variable key-${random}
${result} = Execute ozone sh key put /${volume}/${bucket}/${key} ${file}
[Return] ${key}

Setup volume and bucket
${volume} = Create Volume
Set Suite Variable ${VOLUME} ${volume}
${bucket} = Create bucket ${VOLUME} FILE_SYSTEM_OPTIMIZED
Set Suite Variable ${BUCKET} ${bucket}

Keys creation
${key_one} = Create key ${VOLUME} ${BUCKET} /etc/hosts
Set Suite Variable ${KEY_ONE} ${key_one}
${key_two} = Create key ${VOLUME} ${BUCKET} /etc/os-release
Set Suite Variable ${KEY_TWO} ${key_two}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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 Test HSync during upgrade
Library OperatingSystem
Resource hsync-setup.robot
Suite Setup Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit test user testuser testuser.keytab
Test Timeout 5 minutes

*** Test Cases ***
Test HSync Prior To Finalization
[Tags] pre-finalized-hsync-tests
Setup volume and bucket
Keys creation
${result} = Execute ozone debug recover --path=ofs://om/${VOLUME}/${BUCKET}/${KEY_ONE}
Should contain ${result} NOT_SUPPORTED_OPERATION

Test HSync After Finalization
[Tags] post-finalized-hsync-tests
Setup volume and bucket
Keys creation
${result} = Execute ozone debug recover --path=ofs://om/${VOLUME}/${BUCKET}/${KEY_ONE}
Should contain ${result} Lease recovery SUCCEEDED

0 comments on commit c059858

Please sign in to comment.