From af70b67038c196b4d4a8b4ec9830483d9e687972 Mon Sep 17 00:00:00 2001 From: kshithijiyer Date: Mon, 24 Feb 2020 19:05:13 +0530 Subject: [Testfix] Modify test to work with new performance.io-cache default Problem: The default value of performance.io-cache was ON by default before gluster 6.0, in gluster 6.0 it was set to OFF. Solution: Adding code to check gluster version and then check weather it is ON or OFF as shown below: ``` if get_gluster_version(self.mnode) >= 6.0: self.assertIn("off", ret['performance.io-cache'], "io-cache value is not correct") else: self.assertIn("on", ret['performance.io-cache'], "io-cache value is not correct") ``` CentOS-CI failure analysis: This patch is expected to failed as if we run `gluster --version` on nightly builds the output returned as shown below: ``` # gluster --version glusterfs 20200220.a0e0890 Repository revision: git://git.gluster.org/glusterfs.git Copyright (c) 2006-2016 Red Hat, Inc. GlusterFS comes with ABSOLUTELY NO WARRANTY. It is licensed to you under your choice of the GNU Lesser General Public License, version 3 or any later version (LGPLv3 or later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation. ``` This output can't be parsed by get_gluster_version() function which is used in this patch to get the gluster version and check for perfromance.io-cache's default value accordingly. Change-Id: I00b652a9d5747cbf3006825bb17b9ca2f69cb9cd Signed-off-by: kshithijiyer --- tests/functional/glusterd/test_volume_get.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/functional/glusterd/test_volume_get.py b/tests/functional/glusterd/test_volume_get.py index a451268f7..d38380f60 100644 --- a/tests/functional/glusterd/test_volume_get.py +++ b/tests/functional/glusterd/test_volume_get.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2018 Red Hat, Inc. +# Copyright (C) 2017-2020 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on from glustolibs.gluster.volume_ops import (get_volume_options, set_volume_options) from glustolibs.gluster.lib_utils import is_core_file_created +from glustolibs.gluster.gluster_init import get_gluster_version @runs_on([['distributed', 'replicated', 'distributed-replicated', @@ -175,8 +176,12 @@ class TestVolumeGet(GlusterBaseClass): ret = get_volume_options(self.mnode, self.volname, "io-cache") self.assertIsNotNone(ret, "gluster volume get %s io-cache command " "failed" % self.volname) - self.assertIn("on", ret['performance.io-cache'], "io-cache value " - "is not correct") + if get_gluster_version(self.mnode) >= 6.0: + self.assertIn("off", ret['performance.io-cache'], + "io-cache value is not correct") + else: + self.assertIn("on", ret['performance.io-cache'], + "io-cache value is not correct") g.log.info("io-cache value is correct") # Performing gluster volume set volname performance.low-prio-threads -- cgit