def _assertion(self, checkStr, trueValue, depth=0): if trueValue and self.verbose: print '\t' + Colors.Green('assertion success:\t') + Colors.Yellow( checkStr) + '\t' + Colors.Gray( self._getCallerPosition(3 + depth)) elif not trueValue: FailureSummery = Colors.Bred('assertion faild:\t') + Colors.Yellow( checkStr) + '\t' + Colors.Gray( self._getCallerPosition(3 + depth)) print '\t' + FailureSummery self.assertionFailedSummery.append(FailureSummery)
def _downloadEnterpriseBinaries(self): binariesName = 'binaries.tar' print Colors.Yellow('installing enterprise binaries') print Colors.Yellow('creating RLTest working dir: %s' % RLTest_WORKING_DIR) try: shutil.rmtree(RLTest_WORKING_DIR) os.makedirs(RLTest_WORKING_DIR) except Exception: pass print Colors.Yellow('download binaries') args = [ 'wget', RLTest_ENTERPRISE_URL, '-O', os.path.join(RLTest_WORKING_DIR, binariesName) ] self.process = subprocess.Popen(args=args, stdout=sys.stdout, stderr=sys.stdout) self.process.wait() if self.process.poll() != 0: raise Exception('failed to download enterprise binaries from s3') print Colors.Yellow('extracting binaries') debFileName = 'redislabs_%s-%s~%s_amd64.deb' % ( RLTest_ENTERPRISE_VERSION, RLTest_ENTERPRISE_SUB_VERSION, OS_NAME) args = [ 'tar', '-xvf', os.path.join(RLTest_WORKING_DIR, binariesName), '--directory', RLTest_WORKING_DIR, debFileName ] self.process = subprocess.Popen(args=args, stdout=sys.stdout, stderr=sys.stdout) self.process.wait() if self.process.poll() != 0: raise Exception('failed to extract binaries to %s' % self.RLTest_WORKING_DIR) # TODO: Support centos that does not have dpkg command args = [ 'dpkg', '-x', os.path.join(RLTest_WORKING_DIR, debFileName), RLTest_WORKING_DIR ] self.process = subprocess.Popen(args=args, stdout=sys.stdout, stderr=sys.stdout) self.process.wait() if self.process.poll() != 0: raise Exception('failed to extract binaries to %s' % self.RLTest_WORKING_DIR) print Colors.Yellow('finished installing enterprise binaries')
def _assertion(self, checkStr, trueValue, depth=0): basemsg = Colors.Yellow(checkStr) + '\t' + Colors.Gray( self._getCallerPosition(3 + depth)) if trueValue and self.verbose: print '\t' + Colors.Green('✅ (OK):\t') + basemsg elif not trueValue: failureSummary = Colors.Bred('❌ (FAIL):\t') + basemsg print '\t' + failureSummary if self.defaultExitOnFailure: raise TestAssertionFailure('Assertion Failed!') self.assertionFailedSummary.append(failureSummary)
def printEnvData(self, prefix=''): print Colors.Yellow(prefix + 'master:') self._printEnvData(prefix + '\t', MASTER) if self.useSlaves: print Colors.Yellow(prefix + 'slave:') self._printEnvData(prefix + '\t', SLAVE)
def _printEnvData(self, prefix='', role=MASTER): print Colors.Yellow(prefix + 'pid: %d' % (self.getPid(role))) print Colors.Yellow(prefix + 'port: %d' % (self.getPort(role))) print Colors.Yellow(prefix + 'binary path: %s' % (self.redisBinaryPath)) print Colors.Yellow(prefix + 'server id: %d' % (self.getServerId(role))) print Colors.Yellow(prefix + 'using debugger: {}'.format(bool(self.debugger))) if self.modulePath: print Colors.Yellow(prefix + 'module: %s' % (self.modulePath)) if self.moduleArgs: print Colors.Yellow(prefix + 'module args: %s' % (self.moduleArgs)) if self.outputFilesFormat: print Colors.Yellow(prefix + 'log file: %s' % (self._getFileName(role, '.log'))) print Colors.Yellow(prefix + 'db file name: %s' % self._getFileName(role, '.rdb')) if self.dbDirPath: print Colors.Yellow(prefix + 'db dir path: %s' % (self.dbDirPath)) if self.libPath: print Colors.Yellow(prefix + 'library path: %s' % (self.libPath))