示例#1
0
    def test_loop_execution_no_wait(self):
        adhesive.process.process = read_bpmn_file(
            "test/adhesive/xml/loop.bpmn")

        process_executor = ProcessExecutor(adhesive.process, wait_tasks=False)
        data = process_executor.execute()

        assert_equal_execution(
            {
                "Build Germanium Image on mac": 1,
                "Build Germanium Image on windows": 1,
                "Build Germanium Image on linux": 1,
                "Test Browser ie on linux": 1,
                "Cleanup Platform linux": 3,
                "Cleanup Platform windows": 3,
                "Cleanup Platform mac": 3,
                "Test Browser chrome on linux": 1,
                "Test Browser edge on linux": 1,
                "Test Browser edge on windows": 1,
                "Test Browser chrome on windows": 1,
                "Test Browser ie on windows": 1,
                "Test Browser chrome on mac": 1,
                "Test Browser edge on mac": 1,
                "Test Browser ie on mac": 1,
            },
            data.executions,
        )

        self.assertFalse(process_executor.events)
    def test_error_propagates_up(self):
        """
        Load a process with a gateway and test it..
        """
        adhesive.process.process = read_bpmn_file(
            "test/adhesive/xml/error-event-subprocess-propagates-up.bpmn")

        process_executor = ProcessExecutor(adhesive.process)
        data = process_executor.execute()

        assert_equal_execution(
            {
                "Error Was Caught": 1,
            },
            data.executions,
        )

        self.assertFalse(process_executor.events)
示例#3
0
    def test_log_redirection(self):
        """
        Load a process with a gateway and test it..
        """
        adhesive.process.process = read_bpmn_file(
            "test/adhesive/xml/redirect-logs.bpmn")

        process_executor = ProcessExecutor(adhesive.process)
        data = process_executor.execute()

        assert_equal_execution(
            {
                "sh: echo hello world && echo bad world >&2 && echo good world":
                1,
                "Store current execution id": 1,
            },
            data.executions,
        )
        self.assertFalse(process_executor.events)

        adhesive_temp_folder = config.current.temp_folder
        path_to_glob = os.path.join(adhesive_temp_folder, data.execution_id,
                                    "logs", "_4", "*", "stdout")

        log_path = glob.glob(path_to_glob)

        if not log_path:
            raise Exception(
                f"Unable to match any file for glob {path_to_glob}")

        with open(log_path[0], "rt") as f:
            self.assertEqual(
                f.read(),
                "sh: echo hello world && "
                "echo bad world >&2 && "
                "echo good world\nhello world\ngood world\n",
            )

        log_path = glob.glob(
            os.path.join(adhesive_temp_folder, data.execution_id, "logs", "_4",
                         "*", "stderr"))

        with open(log_path[0], "rt") as f:
            self.assertEqual(f.read(), "bad world\n")
示例#4
0
    def test_error_interrupting(self):
        """
        Load a process with a gateway and test it..
        """
        adhesive.process.process = read_bpmn_file(
            "test/adhesive/xml/error-event-interrupting.bpmn"
        )

        process_executor = ProcessExecutor(adhesive.process)
        data = process_executor.execute()

        print(data._error)

        assert_equal_execution(
            {
                "Cleanup Broken Tasks": 1,
            },
            data.executions,
        )
        self.assertFalse(process_executor.events)
    def test_exclusive_gateway_non_wait(self):
        """
        Load a process with a gateway and test it..
        """
        adhesive.process.process = read_bpmn_file(
            "test/adhesive/xml/gateway-complex.bpmn")

        process_executor = ProcessExecutor(adhesive.process, wait_tasks=False)
        data = process_executor.execute()

        assert_equal_execution(
            {
                "Test Firefox": 1,
                "Test Chrome": 1,
                "Test Browser chrome on linux": 2,
                "Test Browser firefox on linux": 2,
            },
            data.executions,
        )
        self.assertFalse(process_executor.events)
示例#6
0
    def test_sub_process_execution(self):
        """
        Load a process that contains a sub process and execute it.
        """
        adhesive.process.process = read_bpmn_file(
            "test/adhesive/xml/adhesive_subprocess.bpmn")

        process_executor = ProcessExecutor(adhesive.process)
        data = process_executor.execute()

        assert_equal_execution(
            {
                "Ensure Docker Tooling": 1,
                "Build Germanium Image": 1,
                "Prepare Firefox": 1,
                "Test Firefox": 1,
                "Test Chrome": 1,
            },
            data.executions,
        )
        self.assertFalse(process_executor.events)
示例#7
0
    def test_lane_non_wait(self):
        """
        Load a process with a gateway and test it..
        """
        adhesive.process.process = read_bpmn_file(
            "test/adhesive/xml/lane.bpmn")

        process_executor = ProcessExecutor(adhesive.process, wait_tasks=False)
        data = process_executor.execute()

        assert_equal_execution(
            {
                "Prepare Firefox": 1,
                "Test Chrome": 1,
                "Test Firefox": 2,
                "Ensure Docker Tooling": 1,
                "Build Germanium Image": 4,
            },
            data.executions,
        )
        self.assertFalse(process_executor.events)