예제 #1
0
def test_complex_template_versioning(regress_flow_reg, fix_ctv):
    # There is a complex bug where a new flow version cannot be switched to
    # and generates a NiFi NPE if attempted when create_flow_version is used
    # BUG FIXED: issue with variable name found in Swagger definition
    # https://github.com/apache/nifi/pull/2479#issuecomment-366582829

    # Create a new flow version
    vers = versioning.list_flow_versions(fix_ctv.bucket.identifier,
                                         fix_ctv.flow.identifier)
    assert vers[0].version == 2
    # create_flow_version is the problem
    new_ss = versioning.create_flow_version(
        flow=fix_ctv.flow,
        flow_snapshot=fix_ctv.snapshot_w_template,
        refresh=True)
    assert isinstance(new_ss, registry.VersionedFlowSnapshot)
    vers = versioning.list_flow_versions(fix_ctv.bucket.identifier,
                                         fix_ctv.flow.identifier)
    assert vers[0].version == 3
    new_ver_info = versioning.get_version_info(fix_ctv.pg)
    r1 = versioning.update_flow_ver(fix_ctv.pg)
    assert r1.request.complete is True
    assert r1.request.failure_reason is None
    r2 = canvas.schedule_process_group(fix_ctv.pg.id, True)
    status = canvas.get_process_group(fix_ctv.pg.id, 'id')
    assert status.running_count >= 5
    with pytest.raises(ValueError):
        _ = versioning.update_flow_ver(fix_ctv.pg, 'bob')
    with pytest.raises(ValueError):
        _ = versioning.update_flow_ver(fix_ctv.pg, '9999999')
예제 #2
0
def test_nifi_registry_iot(run_id):
    bucket = versioning.get_registry_bucket('IoT')
    assert bucket
    flows = versioning.list_flows_in_bucket(bucket.identifier)
    assert len(flows) == 1
    flow = flows[0]
    versions = versioning.list_flow_versions(bucket.identifier, flow.identifier)
    assert len(versions) >= 2
    assert versions[0].comments == 'Second version - ' + run_id, 'Comments: ' + versions[0].comments
    assert versions[1].comments == 'First version - ' + run_id, 'Comments: ' + versions[1].comments
예제 #3
0
def test_nifi_registry_sensorflows(run_id):
    bucket = versioning.get_registry_bucket('SensorFlows')
    assert bucket
    flows = versioning.list_flows_in_bucket(bucket.identifier)
    assert len(flows) == 1
    flow = flows[0]
    versions = versioning.list_flow_versions(bucket.identifier, flow.identifier)
    assert len(versions) == 3
    assert versions[0].comments == 'Second version - ' + run_id, 'Comments: ' + versions[0].comments
    assert versions[1].comments == 'First version - ' + run_id, 'Comments: ' + versions[1].comments
    assert versions[2].comments == 'Enabled version control - ' + run_id, 'Comments: ' + versions[2].comments