| 26 | import sys |
| 27 | |
| 28 | class ReplicationUtils(object): |
| 29 | |
| 30 | thisClassName = '(ReplicationUtils)' |
| 31 | d = {'name_of_class': thisClassName} |
| 32 | |
| 33 | logger = logging.getLogger("namedLogger") |
| 34 | anonLogger = logging.getLogger("anonymousLogger") |
| 35 | |
| 36 | def __init__(self, testClassInstance): |
| 37 | super(ReplicationUtils, self).__init__() |
| 38 | self.logger.debug("#### constructor inside ReplicationUtils", extra=self.d) |
| 39 | |
| 40 | # leader attributes |
| 41 | self.isLeaderLogPattern = "Completed the leader state transition" |
| 42 | self.brokerShutDownCompletedPattern = "shut down completed" |
| 43 | |
| 44 | self.leaderAttributesDict = {} |
| 45 | |
| 46 | self.leaderAttributesDict["BROKER_SHUT_DOWN_COMPLETED_MSG"] = \ |
| 47 | self.brokerShutDownCompletedPattern |
| 48 | |
| 49 | self.leaderAttributesDict["REGX_BROKER_SHUT_DOWN_COMPLETED_PATTERN"] = \ |
| 50 | "\[(.*?)\] .* \[Kafka Server (.*?)\], " + \ |
| 51 | self.brokerShutDownCompletedPattern |
| 52 | |
| 53 | self.leaderAttributesDict["LEADER_ELECTION_COMPLETED_MSG"] = \ |
| 54 | self.isLeaderLogPattern |
| 55 | |
| 56 | self.leaderAttributesDict["REGX_LEADER_ELECTION_PATTERN"] = \ |
| 57 | "\[(.*?)\] .* Broker (.*?): " + \ |
| 58 | self.leaderAttributesDict["LEADER_ELECTION_COMPLETED_MSG"] + \ |
| 59 | " for topic (.*?) partition (.*?) \(.*" |
| 60 | |
| 61 | # Controller attributes |
| 62 | self.isControllerLogPattern = "Controller startup complete" |
| 63 | self.controllerAttributesDict = {} |
| 64 | self.controllerAttributesDict["CONTROLLER_STARTUP_COMPLETE_MSG"] = self.isControllerLogPattern |
| 65 | self.controllerAttributesDict["REGX_CONTROLLER_STARTUP_PATTERN"] = "\[(.*?)\] .* \[Controller (.*?)\]: " + \ |
| 66 | self.controllerAttributesDict["CONTROLLER_STARTUP_COMPLETE_MSG"] |
| 67 | |
| 68 | # Data Loss Percentage Threshold in Ack = 1 cases |
| 69 | self.ackOneDataLossThresholdPercent = 5.0 |
| 70 | |