コード例 #1
0
    def apply(self):
        """
        Apply all changes to this table.

        Note that the only way to abort changes is to call
        TableState.reset(); otherwise the changes remain queued up and happen
        the next time TableState.apply() is called.
        """
        ops = []
        for table in self.tables_v4.values() + self.tables_v6.values():
            ops.extend(table.ops)
            table.ops = []

        if ops:
            log.debug("Apply batched changes to tables")
            futils.multi_call(ops)
        else:
            log.debug("No table changes required")
コード例 #2
0
    def test_multi_call(self):
        # Test multiple command calls; this just stores the command values.
        ops = [ ["ls"], ["ls", "calico"] ]
        expected = "set -e\n"
        for op in ops:
            cmd = " ".join(op) + "\n"
            expected += "echo Executing : " + cmd + cmd

        with mock.patch('calico.felix.futils.check_call', side_effect=self.stub_store_calls):
            result = futils.multi_call(ops)

        self.assertEqual(expected, self.data)
コード例 #3
0
ファイル: test_futils.py プロジェクト: alogoc/calico
    def test_multi_call(self):
        # Test multiple command calls; this just stores the command values.
        ops = [ ["ls"], ["ls", "calico"] ]
        expected = "set -e\n"
        for op in ops:
            cmd = " ".join(op) + "\n"
            expected += "echo Executing : " + cmd + cmd

        with mock.patch('calico.felix.futils.check_call', side_effect=self.stub_store_calls):
            result = futils.multi_call(ops)

        self.assertEqual(expected, self.data)