Example #1
0
    def setUp(self):

        self.cl1 = clactions.GerritChangeTuple(11111, True)
        self.cl1_patch1 = clactions.GerritPatchTuple(self.cl1.gerrit_number, 1,
                                                     self.cl1.internal)
        self.cl1_patch2 = clactions.GerritPatchTuple(self.cl1.gerrit_number, 2,
                                                     self.cl1.internal)

        self.cl2 = clactions.GerritChangeTuple(22222, True)
        self.cl2_patch1 = clactions.GerritPatchTuple(self.cl2.gerrit_number, 1,
                                                     self.cl2.internal)
        self.cl2_patch2 = clactions.GerritPatchTuple(self.cl2.gerrit_number, 2,
                                                     self.cl2.internal)

        self.cl3 = clactions.GerritChangeTuple(33333, True)
        self.cl3_patch1 = clactions.GerritPatchTuple(self.cl3.gerrit_number, 2,
                                                     self.cl3.internal)

        # Expected actions in chronological order, most recent first.
        self.action1 = clactions.CLAction.FromGerritPatchAndAction(
            self.cl1_patch2,
            constants.CL_ACTION_SUBMITTED,
            timestamp=self._NDaysAgo(1))
        self.action2 = clactions.CLAction.FromGerritPatchAndAction(
            self.cl1_patch2,
            constants.CL_ACTION_KICKED_OUT,
            timestamp=self._NDaysAgo(2))
        self.action3 = clactions.CLAction.FromGerritPatchAndAction(
            self.cl2_patch2,
            constants.CL_ACTION_SUBMITTED,
            timestamp=self._NDaysAgo(3))
        self.action4 = clactions.CLAction.FromGerritPatchAndAction(
            self.cl1_patch1,
            constants.CL_ACTION_SUBMIT_FAILED,
            timestamp=self._NDaysAgo(4))
        self.action5 = clactions.CLAction.FromGerritPatchAndAction(
            self.cl1_patch1,
            constants.CL_ACTION_KICKED_OUT,
            timestamp=self._NDaysAgo(5))
        self.action6 = clactions.CLAction.FromGerritPatchAndAction(
            self.cl3_patch1,
            constants.CL_ACTION_SUBMITTED,
            reason=constants.STRATEGY_NONMANIFEST,
            timestamp=self._NDaysAgo(6))

        # CLActionHistory does not require the history to be given in chronological
        # order, so we provide them in reverse order, and expect them to be sorted
        # as appropriate.
        self.cl_action_stats = clactions.CLActionHistory([
            self.action1, self.action2, self.action3, self.action4,
            self.action5, self.action6
        ])
Example #2
0
    def setUp(self):
        self._days_forward = 1
        self._build_id = 1
        self.action_history = []
        self.cl_action_stats = None

        self.cl1 = clactions.GerritChangeTuple(11111, True)
        self.cl1_patch1 = clactions.GerritPatchTuple(self.cl1.gerrit_number, 1,
                                                     self.cl1.internal)
        self.cl1_patch2 = clactions.GerritPatchTuple(self.cl1.gerrit_number, 2,
                                                     self.cl1.internal)

        self.cl2 = clactions.GerritChangeTuple(22222, True)
        self.cl2_patch1 = clactions.GerritPatchTuple(self.cl2.gerrit_number, 1,
                                                     self.cl2.internal)
        self.cl2_patch2 = clactions.GerritPatchTuple(self.cl2.gerrit_number, 2,
                                                     self.cl2.internal)