This is an automated email from the ASF dual-hosted git repository. zabetak pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hive.git
commit 089e2727cb9b2855d9c1ad2b7a789b7afb8fc5a5 Author: rkirti <rki...@cloudera.com> AuthorDate: Wed Oct 11 13:40:47 2023 +0530 HIVE-27745: Add unit test to ensure short version is inline with full version (Kirti Ruge reviewed by Stamatis Zampetakis) Close apache/hive#4791 --- .../metastore/utils/TestMetastoreVersionInfo.java | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/standalone-metastore/metastore-common/src/test/java/org/apache/hadoop/hive/metastore/utils/TestMetastoreVersionInfo.java b/standalone-metastore/metastore-common/src/test/java/org/apache/hadoop/hive/metastore/utils/TestMetastoreVersionInfo.java new file mode 100644 index 00000000000..e256befa62b --- /dev/null +++ b/standalone-metastore/metastore-common/src/test/java/org/apache/hadoop/hive/metastore/utils/TestMetastoreVersionInfo.java @@ -0,0 +1,45 @@ +/* + * 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. + */ +package org.apache.hadoop.hive.metastore.utils; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class TestMetastoreVersionInfo { + + private String hiveShortVersion; + private String hiveVersion; + + @Before + public void setUp() throws Exception { + hiveShortVersion = MetastoreVersionInfo.getShortVersion(); + hiveVersion = MetastoreVersionInfo.getVersion(); + } + + @Test + public void testValidateHiveShortVersionWithHiveVersion() { + Assert.assertEquals(hiveVersion.replace("-SNAPSHOT", ""), hiveShortVersion); + } + + @Test + public void testIfHiveVersionHasShortVersionAsPrefix() { + Assert.assertTrue(hiveVersion.startsWith(hiveShortVersion)); + } +} +