Exemplo n.º 1
0
def test_client_recursion_limit(fix_pg, fix_funnel, target=450):
    # https://github.com/Chaffelson/nipyapi/issues/147
    parent_pg = canvas.get_process_group('root')
    for i in range(0, target):
        parent_pg = fix_pg.generate(parent_pg, str(i))
        fix_funnel.generate(parent_pg)
    start = time.time()
    r1 = canvas.list_all_process_groups(canvas.get_root_pg_id())
    end = time.time()
    assert len(r1) == target + 1  # +1 to allow for root PG
    print("Len {0}  Set {1}".format(len(r1), len(set([x.id for x in r1]))))
    print("Elapsed r1: {0}".format((end - start)))
Exemplo n.º 2
0
    def test_run(self):
        content_string = "This is the content of the test message"

        message = FlowFile(content_string, {"attribute1": "value1"})
        result = Test1To1Test.test.run("Processor 2", message)
        # Check result
        assert result.content == content_string
        assert result.attributes['test_input_name'] == self.proc_2.component.name
        assert result.attributes['test_output_name'] == self.proc_3.component.name
        assert int(result.attributes['test_start_time']) > 0
        assert int(result.attributes['test_end_time']) > 0
        assert int(result.attributes['test_duration']) == int(result.attributes['test_end_time']) - int(result.attributes['test_start_time'])

        # Check is test was cleaned up nicely
        # The test process group should be removed
        assert len(canvas.list_all_process_groups(Test1To1Test.pg_test.component.id)) == 1  # Only counting self
        # Check if connections were built again; there should be 3 now
        assert len(canvas.list_all_connections(Test1To1Test.pg_test.component.id, descendants=False)) == 3
Exemplo n.º 3
0
def nifi_delete_all(pg):
    canvas.schedule_process_group(pg.id, False)
    for conn in canvas.list_all_connections(pg.id):
        LOG.debug('Connection: ' + conn.id)
        canvas.delete_connection(conn, purge=True)
    for input_port in canvas.list_all_input_ports(pg.id):
        LOG.debug('Input Port: ' + input_port.id)
        canvas.delete_port(input_port)
    for output_port in canvas.list_all_output_ports(pg.id):
        LOG.debug('Output Port: ' + output_port.id)
        canvas.delete_port(output_port)
    for funnel in canvas.list_all_funnels(pg.id):
        LOG.debug('Funnel: ' + funnel.id)
        canvas.delete_funnel(funnel)
    for processor in canvas.list_all_processors(pg.id):
        LOG.debug('Processor: ' + processor.id)
        canvas.delete_processor(processor, force=True)
    for process_group in canvas.list_all_process_groups(pg.id):
        if pg.id == process_group.id:
            continue
        LOG.debug('Process Group: ' + process_group.id)
        nifi_delete_all(process_group)
        canvas.delete_process_group(process_group, force=True)
Exemplo n.º 4
0
def test_list_all_process_groups(fixture_pg, regress):
    _ = fixture_pg.generate()
    r = canvas.list_all_process_groups()
    assert isinstance(r, list)
    for pg in r:
        assert isinstance(pg, ProcessGroupEntity)
Exemplo n.º 5
0
def test_data_flowing():
    for pg in canvas.list_all_process_groups():
        if pg.status.name == 'NiFi Flow':
            continue
        assert pg.status.aggregate_snapshot.bytes_in > 0