示例#1
0
    def setUpClass(cls):
        super(EtablefuncGppcTestCase, cls).setUpClass()
        """
        compile tablefunc_gppc_demo.c and install the tablefunc_gppc_demo.so
        """
        gppkg = Gppkg()
        gpccutil.pre_process(product_version)
        result = gppkg.gppkg_install(product_version, "libgppc")
        # makeLog = loal_path('test00MakeLog.out')
        if result:
            cmdMakeInstall = (
                "cd " + local_path("data") + " && make clean && make CPPFLAGS=-D_GNU_SOURCE && make install"
            )
            res = {"rc": 0, "stderr": "", "stdout": ""}
            run_shell_command(cmdMakeInstall, "compile tablefunc_gppc_demo.c", res)

            # Current make file works for linux, but not for Solaris or OSX.
            # If compilation fails or installation fails, force system quit: os._exit(1)
            if res["rc"]:
                os._exit(1)  # This will exit the test including the next test suites
            sharedObj = "%s/tabfunc_gppc_demo.so" % (LIBDIR)
            if not os.path.isfile(sharedObj):
                os._exit(1)

            # For multinode cluster, need to copy shared object tabfunc_gppc_demo.so to all primary segments
            if gpdbconfig.is_multinode():
                res = {"rc": 0, "stderr": "", "stdout": ""}
                hosts = gpdbconfig.get_hosts(segments=True)
                scp_cmd = "gpscp  -h " + " -h ".join(map(str, hosts)) + " " + sharedObj + " =:%s" % LIBDIR
                run_shell_command(scp_cmd)
                if res["rc"]:
                    raise Excpetion("Could not copy shared object to primary segment")
示例#2
0
    def setUpClass(self):
        super(MapreduceMPPTestCase, self).setUpClass()
        gppkg = Gppkg()
        gppkg.gppkg_install(product_version, 'plperl')
        setup_command = "create language plperl;"
        PSQL.run_sql_command(setup_command, dbname = os.environ.get('PGDATABASE'))

        "compile functions.c and build functions.so"
        makeLog = local_path('testBuildSOLog.out')
        cmdMake = 'cd '+local_path('c_functions') + ' && make clean && make'
        res = {'rc': 0, 'stdout' : '', 'stderr': ''}
        run_shell_command(cmdMake, 'compile functions.c', res)
        file = open(makeLog, 'w')
        file.write(res['stdout'])
        file.close()
        if res['rc']:
            raise Exception('a problem occurred while creating the so files ')
        so_dir = local_path('c_functions')
        sharedObj = local_path('c_functions/functions.so')
        # if not os.path.isfile(sharedObj):
            #raise gptest.GPTestError('so files does not exist')

        # For multinode cluster, need to copy shared object tabfunc_gppc_demo.so to all primary segments
        if gpdbconfig.is_multinode():
            res = {'rc':0, 'stderr':'', 'stdout':''}
            hosts = gpdbconfig.get_hosts(segments=True)
            scp_cmd = 'gpscp  -h ' +' -h '.join(map(str,hosts)) +' '+ sharedObj + ' =:%s' % so_dir
            run_shell_command(scp_cmd)
            if res['rc']:
                raise Exception('Could not copy shared object to primary segment')
示例#3
0
    def setUpClass(cls):
        """
        Checking if plperl package installed, otherwise install the package
        """
        super(MDTSQLTestCase, cls).setUpClass()
        mdt.pre_process_sql()
        mdt.pre_process_ans()
        mdt.setup_gpfdist()

        cmd = 'gpssh --version'
        res = {'rc': 0, 'stderr': '', 'stdout': ''}
        run_shell_command(cmd, 'check product version', res)
        gppkg = Gppkg()
        product_version = res['stdout']
        gppkg.gppkg_install(product_version, 'plperl')

        setup_user = '******'
        setup_db = 'create database mdt_db;'
        setup_sql = local_path('sql/setup/setup.sql')
        setup_output = local_path('output/setup/setup.out')
        PSQL.run_sql_command(sql_cmd=setup_user,
                             dbname=os.environ.get('PGDATABASE'))
        PSQL.run_sql_command(sql_cmd=setup_db,
                             dbname=os.environ.get('PGDATABASE'),
                             username='******')
        PSQL.run_sql_file(sql_file=setup_sql,
                          out_file=setup_output,
                          dbname='mdt_db',
                          username='******')
示例#4
0
    def setUpClass(self):
        super(MapreduceMPPTestCase, self).setUpClass()
        gppkg = Gppkg()
        gppkg.gppkg_install(product_version, 'plperl')
        setup_command = "create language plperl;"
        PSQL.run_sql_command(setup_command,
                             dbname=os.environ.get('PGDATABASE'))

        "compile functions.c and build functions.so"
        makeLog = local_path('testBuildSOLog.out')
        cmdMake = 'cd ' + local_path('c_functions') + ' && make clean && make'
        res = {'rc': 0, 'stdout': '', 'stderr': ''}
        run_shell_command(cmdMake, 'compile functions.c', res)
        file = open(makeLog, 'w')
        file.write(res['stdout'])
        file.close()
        if res['rc']:
            raise Exception('a problem occurred while creating the so files ')
        so_dir = local_path('c_functions')
        sharedObj = local_path('c_functions/functions.so')
        # if not os.path.isfile(sharedObj):
        #raise gptest.GPTestError('so files does not exist')

        # For multinode cluster, need to copy shared object tabfunc_gppc_demo.so to all primary segments
        if gpdbconfig.is_multinode():
            res = {'rc': 0, 'stderr': '', 'stdout': ''}
            hosts = gpdbconfig.get_hosts(segments=True)
            scp_cmd = 'gpscp  -h ' + ' -h '.join(map(
                str, hosts)) + ' ' + sharedObj + ' =:%s' % so_dir
            run_shell_command(scp_cmd)
            if res['rc']:
                raise Exception(
                    'Could not copy shared object to primary segment')
示例#5
0
    def setUpClass(cls):
        super(GppcTestCase, cls).setUpClass()
        """
        compile gppc_test.c and install the gppc_test.so
        """
        gpccutil.pre_process()
        cmd = 'gpssh --version'
        res = {'rc':0, 'stderr':'', 'stdout':''}
        run_shell_command (cmd, 'check product version', res)
        gppkg = Gppkg()
        product_version = res['stdout']
        result = gppkg.gppkg_install(product_version, 'libgppc')
        #makeLog = loal_path('test00MakeLog.out')
        if result:
            cmdMakeInstall = 'cd '+local_path('data')+' && make clean && make CPPFLAGS=-D_GNU_SOURCE && make install'
            res = {'rc':0, 'stderr':'', 'stdout':''}
            run_shell_command (cmdMakeInstall, 'compile gppc_test.c', res)

            # Current make file works for linux, but not for Solaris or OSX.
            # If compilation fails or installation fails, force system quit: os._exit(1)
            if res['rc']:
                os._exit(1) # This will exit the test including the next test suites
            sharedObj = local_path('data/gppc_test.so')
            if not os.path.isfile(sharedObj):
                os._exit(1)

            # For multinode cluster, need to copy shared object tabfunc_gppc_demo.so to all primary segments
            res = {'rc':0, 'stderr':'', 'stdout':''}
            hosts = gpdbconfig.get_hosts(segments=True)
            scp_cmd = 'gpscp  -h ' +' -h '.join(map(str,hosts)) +' '+ sharedObj + ' =:%s' % LIBDIR
            run_shell_command(scp_cmd, 'scp share object to all segment', res)
            tinctest.logger.info('scp shared object result %s' % res['stdout'])
            if res['rc']:
                raise Excpetion('Could not copy shared object to primary segment')
示例#6
0
    def setUpClass(self):
        super(PgcryptoScenarioTestCase, self).setUpClass()
        gppkg = Gppkg()
        gppkg.gppkg_install(product_version, 'pgcrypto')

        res = {'rc': 0, 'stdout' : '', 'stderr': ''}
        run_shell_command(". $GPHOME/greenplum_path.sh; psql -d %s -f $GPHOME/share/postgresql/contrib/pgcrypto.sql" % os.environ.get('PGDATABASE'), 'pgcrypto: setup', res)
        tinctest.logger.info('result from installing pgcrypto %s' % res['stdout'])
示例#7
0
 def install_plperl(self):
     """
     @summary: Installs plperl gppkg and creates plperl language in database if it doesn't exist
     
     """
     gppkg = Gppkg()
     gppkg.gppkg_install(product_version, 'plperl')
     if self.pl.language_in_db('plperl') == False:
         self.pl.create_language_in_db('plperl')
示例#8
0
 def setUpClass(self):
     """
     @summary: check if current OS is supported for gppkg.  If not, test is skipped.
     
     """
     cmd = 'gpssh --version'
     res = {'rc': 0, 'stderr': '', 'stdout': ''}
     run_shell_command(cmd, 'check product version', res)
     gppkg = Gppkg()
     product_version = res['stdout']
     gppkg.gppkg_install(product_version, 'pgcrypto')
示例#9
0
 def setUpClass(cls):
     """
     Checking if plperl package installed, otherwise install the package
     """
     super(SubtLimitTestCase, cls).setUpClass()
     cmd = 'gpssh --version'
     res = {'rc':0, 'stderr':'', 'stdout':''}
     run_shell_command (cmd, 'check product version', res)
     gppkg = Gppkg()
     product_version = res['stdout']
     gppkg.gppkg_install(product_version, 'plperl')
示例#10
0
 def setUpClass(cls):
     """
     Checking if plperl package installed, otherwise install the package
     """
     super(SubtLimitTestCase, cls).setUpClass()
     cmd = 'gpssh --version'
     res = {'rc': 0, 'stderr': '', 'stdout': ''}
     run_shell_command(cmd, 'check product version', res)
     gppkg = Gppkg()
     product_version = res['stdout']
     gppkg.gppkg_install(product_version, 'plperl')
示例#11
0
 def setUpClass(self):
     """
     @summary: check if current OS is supported for gppkg.  If not, test is skipped.
     
     """
     cmd = 'gpssh --version'
     res = {'rc':0, 'stderr':'', 'stdout':''}
     run_shell_command (cmd, 'check product version', res)
     gppkg = Gppkg()
     product_version = res['stdout']
     gppkg.gppkg_install(product_version, 'pgcrypto')
示例#12
0
 def test_install_should_fail(self):
     """@product_version gpdb: [4.3.5.0 -]"""
     "Old package on the new database which is above the version of 4.3.5.0 should fail"
     gppkg = Gppkg()
     build_type = None
     if os.environ.get("BUILD_TYPE"):
         build_type = os.environ["BUILD_TYPE"]
     os.environ["BUILD_TYPE"] = 'rc'
     with self.assertRaisesRegexp(Exception, 'Failed to install'):
         gppkg.gppkg_install(product_version='4.3.4.0', gppkg=pkgname)
     if build_type is not None:
         os.environ["BUILD_TYPE"] = build_type
     existed, _ = gppkg.check_pkg_exists(pkgname)
     self.assertFalse(existed)
示例#13
0
 def test_install_should_fail(self):
     """@product_version gpdb: [4.3.5.0 -]"""
     "Old package on the new database which is above the version of 4.3.5.0 should fail"
     gppkg = Gppkg()
     build_type = None
     if os.environ.get("BUILD_TYPE"):
         build_type = os.environ["BUILD_TYPE"]
     os.environ["BUILD_TYPE"] = "rc"
     with self.assertRaisesRegexp(Exception, "Failed to install"):
         gppkg.gppkg_install(product_version="4.3.4.0", gppkg=pkgname)
     if build_type is not None:
         os.environ["BUILD_TYPE"] = build_type
     existed, _ = gppkg.check_pkg_exists(pkgname)
     self.assertFalse(existed)
示例#14
0
    def setUpClass(cls):
        super(GppcTestCase, cls).setUpClass()
        """
        compile gppc_test.c and install the gppc_test.so
        """
        gpccutil.pre_process()
        cmd = 'gpssh --version'
        res = {'rc': 0, 'stderr': '', 'stdout': ''}
        run_shell_command(cmd, 'check product version', res)
        gppkg = Gppkg()
        product_version = res['stdout']
        result = gppkg.gppkg_install(product_version, 'libgppc')
        #makeLog = loal_path('test00MakeLog.out')
        if result:
            cmdMakeInstall = 'cd ' + local_path(
                'data'
            ) + ' && make clean && make CPPFLAGS=-D_GNU_SOURCE && make install'
            res = {'rc': 0, 'stderr': '', 'stdout': ''}
            run_shell_command(cmdMakeInstall, 'compile gppc_test.c', res)

            # Current make file works for linux, but not for Solaris or OSX.
            # If compilation fails or installation fails, force system quit: os._exit(1)
            if res['rc']:
                os._exit(
                    1
                )  # This will exit the test including the next test suites
            sharedObj = local_path('data/gppc_test.so')
            if not os.path.isfile(sharedObj):
                os._exit(1)

            # For multinode cluster, need to copy shared object tabfunc_gppc_demo.so to all primary segments
            res = {'rc': 0, 'stderr': '', 'stdout': ''}
            hosts = gpdbconfig.get_hosts(segments=True)
            scp_cmd = 'gpscp  -h ' + ' -h '.join(map(
                str, hosts)) + ' ' + sharedObj + ' =:%s' % LIBDIR
            run_shell_command(scp_cmd, 'scp share object to all segment', res)
            tinctest.logger.info('scp shared object result %s' % res['stdout'])
            if res['rc']:
                raise Excpetion(
                    'Could not copy shared object to primary segment')
示例#15
0
文件: test_mdt.py 项目: 50wu/gpdb
    def setUpClass(cls):
        """
        Checking if plperl package installed, otherwise install the package
        """
        super(MDTSQLTestCase, cls).setUpClass()
        mdt.pre_process_sql()
        mdt.pre_process_ans()
        mdt.setup_gpfdist()

        cmd = 'gpssh --version'
        res = {'rc':0, 'stderr':'', 'stdout':''}
        run_shell_command(cmd, 'check product version', res)
        gppkg = Gppkg()
        product_version = res['stdout']
        gppkg.gppkg_install(product_version, 'plperl')

        setup_user = '******'
        setup_db = 'create database mdt_db;'
        setup_sql = local_path('sql/setup/setup.sql')
        setup_output = local_path('output/setup/setup.out')
        PSQL.run_sql_command(sql_cmd=setup_user, dbname=os.environ.get('PGDATABASE'))
        PSQL.run_sql_command(sql_cmd=setup_db, dbname=os.environ.get('PGDATABASE'), username='******')
        PSQL.run_sql_file(sql_file = setup_sql, out_file=setup_output, dbname='mdt_db', username='******')
示例#16
0
文件: test_postgis.py 项目: 50wu/gpdb
 def setUpClass(self):
     super(PostgisTestCase, self).setUpClass()
     gppkg = Gppkg()
     gppkg.gppkg_install(product_version, 'postgis')
示例#17
0
 def setUpClass(self):
     super(PlperlMPPTestCase, self).setUpClass()
     gppkg = Gppkg()
     gppkg.gppkg_install(product_version, 'plperl')
示例#18
0
 def setUpClass(self):
     gppkg = Gppkg()
     gppkg.gppkg_install(product_version, 'plr')
     gppkg.gppkg_install(product_version, 'pljava')
     gppkg.gppkg_install(product_version, 'plperl')
示例#19
0
 def setUpClass(self):
     super(PlrMPPTestCase, self).setUpClass()
     gppkg = Gppkg()
     gppkg.gppkg_install(product_version, 'plr')
示例#20
0
 def setUpClass(self):
     super(SpiMPPTestCase, self).setUpClass()
     gppkg = Gppkg()
     gppkg.gppkg_install(product_version, "plperl")
     setup_file = local_path("setup.sql")
     PSQL.run_sql_file(setup_file)
示例#21
0
 def setUpClass(self):
     super(PostgisTestCase, self).setUpClass()
     gppkg = Gppkg()
     gppkg.gppkg_install(product_version, 'postgis')
示例#22
0
 def setUpClass(self):
     super(SpiMPPTestCase, self).setUpClass()
     gppkg = Gppkg()
     gppkg.gppkg_install(product_version, 'plperl')
     setup_file = local_path('setup.sql')
     PSQL.run_sql_file(setup_file)
示例#23
0
 def setUpClass(self):
     gppkg = Gppkg()
     gppkg.gppkg_install(product_version, 'plr')
     gppkg.gppkg_install(product_version, 'pljava')
     gppkg.gppkg_install(product_version, 'plperl')
示例#24
0
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.
"""

import os
import tinctest
from mpp.models import MPPTestCase
from mpp.lib.gppkg.gppkg import Gppkg

gppkg = Gppkg()
pkgname = 'plperl'


class CompatiblityMPPTestCase(MPPTestCase):
    def __init__(self, methodName):
        super(CompatiblityMPPTestCase, self).__init__(methodName)

    @classmethod
    def setUpClass(self):
        super(CompatiblityMPPTestCase, self).setUpClass()
        gppkg.run_gppkg_uninstall(pkgname)

    def test_install_should_fail(self):
        """@product_version gpdb: [4.3.5.0 -]"""
        "Old package on the new database which is above the version of 4.3.5.0 should fail"