def test_relation_filter_relkind():
    query = LOCK_METRICS['query'].replace('{metrics_columns}', 'foo')
    relations_config = [{'relation_regex': 'b.*', 'schemas': [ALL_SCHEMAS], 'relkind': ['r', 't']}]
    relations = RelationsManager(relations_config)
    query_filter = relations.filter_relation_query(query, SCHEMA_NAME)
    assert ("AND relkind = ANY(array['r','t'])" in query_filter)
def test_relation_filter_relkind():
    query = LOCK_METRICS['query'].replace('{metrics_columns}', 'foo')
    relations_config = [{'relation_regex': 'b.*', 'schemas': [ALL_SCHEMAS], 'relkind': ['r', 't']}]
    relations = RelationsManager(relations_config)
    query_filter = relations.filter_relation_query(query, SCHEMA_NAME)
    assert ("AND relkind = ANY(array['r','t'])" in query_filter)