Exemple #1
0
    def __init__(self,
                 testName=None,
                 testDescription=None,
                 module=None,
                 moduleArgs=None,
                 env=None,
                 useSlaves=None,
                 shardsCount=None,
                 useAof=None):
        self.testName = testName if testName else '%s.%s' % (
            inspect.getmodule(inspect.currentframe().f_back).__name__,
            inspect.currentframe().f_back.f_code.co_name)
        self.testName = self.testName.replace(' ', '_')

        if testDescription:
            print Colors.Gray('\tdescription: ' + testDescription)

        self.module = module if module else Env.defaultModule
        self.moduleArgs = moduleArgs if moduleArgs else Env.defaultModuleArgs
        self.env = env if env else Env.defaultEnv
        self.useSlaves = useSlaves if useSlaves else Env.defaultUseSlaves
        self.shardsCount = shardsCount if shardsCount else Env.defaultShardsCount
        self.useAof = useAof if useAof else Env.defaultUseAof
        self.verbose = Env.defaultVerbose
        self.logDir = Env.defaultLogDir

        self.assertionFailedSummary = []

        if Env.RTestInstance.currEnv and self.compareEnvs(
                Env.RTestInstance.currEnv):
            self.envRunner = Env.RTestInstance.currEnv.envRunner
        else:
            if Env.RTestInstance.currEnv:
                Env.RTestInstance.currEnv.stop()
            self.envRunner = self.getEnvByName()

        try:
            os.makedirs(self.logDir)
        except Exception:
            pass

        self.start()
        if self.verbose >= 2:
            print Colors.Blue('\tenv data:')
            self.envRunner.printEnvData('\t\t')

        Env.RTestInstance.currEnv = self

        if Env.defaultDebug:
            raw_input(
                '\tenv is up, attach to any process with gdb and press any button to continue.'
            )
Exemple #2
0
    def __init__(
        self,
        testName=None,
        module=None,
        moduleArgs=None,
        env=None,
        useSlaves=None,
        shardsCount=None,
        useAof=None,
    ):
        self.testName = testName if testName else '%s.%s' % (
            inspect.getmodule(inspect.currentframe().f_back).__name__,
            inspect.currentframe().f_back.f_code.co_name)
        self.testNamePrintable = self.testName
        self.testName = self.testName.replace(' ', '_')

        print Colors.Cyan(self.testNamePrintable + ':')

        self.module = module if module else Env.defaultModule
        self.moduleArgs = moduleArgs if moduleArgs else Env.defaultModuleArgs
        self.env = env if env else Env.defaultEnv
        self.useSlaves = useSlaves if useSlaves else Env.defaultUseSlaves
        self.shardsCount = shardsCount if shardsCount else Env.defaultShardsCount
        self.useAof = useAof if useAof else Env.defaultUseAof
        self.verbose = Env.defaultVerbose
        self.logDir = Env.defaultLogDir

        self.assertionFailedSummery = []

        if Env.RTestInstance.currEnv and self.compareEnvs(
                Env.RTestInstance.currEnv):
            self.envRunner = Env.RTestInstance.currEnv.envRunner
        else:
            if Env.RTestInstance.currEnv:
                Env.RTestInstance.currEnv.stop()
            self.envRunner = self.getEnvByName()

        try:
            os.makedirs(self.logDir)
        except Exception:
            pass

        self.start()
        if self.verbose >= 2:
            print Colors.Blue('\tenv data:')
            self.envRunner.printEnvData('\t\t')

        Env.RTestInstance.currEnv = self