コード例 #1
0
def test(writer):
    writer.write_test_file(
        'Valid',
        schema='TOP_LEVEL_CONFIG_SCHEMA',
        data=get_blob(TOP_LEVEL_CONFIG_BLOB),
        throws=False,
    )

    blob = get_blob(TOP_LEVEL_CONFIG_BLOB)
    blob['tracing']['http']['driver']['type'] = 'unknown'
    writer.write_test_file(
        'UnsupportedTracingDriver',
        schema='TOP_LEVEL_CONFIG_SCHEMA',
        data=blob,
        throws=True,
    )
コード例 #2
0
def test(writer):

  writer.write_test_file(
      'Valid',
      schema='ROUTE_CONFIGURATION_SCHEMA',
      data=get_blob(ROUTE_CONFIGURATION_BLOB),
      throws=False,
  )
コード例 #3
0
def test(writer):

  writer.write_test_file(
      'Valid',
      schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
      data=get_blob(HTTP_CONN_NETWORK_FILTER_BLOB),
      throws=False,
  )
コード例 #4
0
def test(writer):
    
    writer.write_test_file(
        'Valid',
        schema='CLUSTER_SCHEMA',
        data=get_blob(CLUSTER_BLOB),
        throws=False,
    )

    blob = get_blob(CLUSTER_BLOB)
    blob['features'] = "nonexistentfeature"
    writer.write_test_file(
        'UnsupportedFeature',
        schema='CLUSTER_SCHEMA',
        data=blob,
        throws=True,
    )
コード例 #5
0
ファイル: test_cluster_schema.py プロジェクト: zwoop/envoy
def test(writer):

    writer.write_test_file(
        'Valid',
        schema='CLUSTER_SCHEMA',
        data=get_blob(CLUSTER_BLOB),
        throws=False,
    )

    blob = get_blob(CLUSTER_BLOB)
    blob['features'] = "nonexistentfeature"
    writer.write_test_file(
        'UnsupportedFeature',
        schema='CLUSTER_SCHEMA',
        data=blob,
        throws=True,
    )
コード例 #6
0
def test(writer):
    
    writer.write_test_file(
        'Valid',
        schema='LISTENER_SCHEMA',
        data=get_blob(LISTENER_BLOB),
        throws=False,
    )
コード例 #7
0
def test(writer):
    
    writer.write_test_file(
        'Valid',
        schema='ROUTE_CONFIGURATION_SCHEMA',
        data=get_blob(ROUTE_CONFIGURATION_BLOB),
        throws=False,
    )
コード例 #8
0
def test(writer):
    
    writer.write_test_file(
        'Valid',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=get_blob(HTTP_CONN_NETWORK_FILTER_BLOB),
        throws=False,
    )
コード例 #9
0
def test(writer):
    writer.write_test_file(
        'Valid',
        schema='ROUTER_HTTP_FILTER_SCHEMA',
        data=get_blob(ROUTER_HTTP_FILTER_BLOB),
        throws=False,
    )

    writer.write_test_file(
        'ValidDefaults',
        schema='ROUTER_HTTP_FILTER_SCHEMA',
        data={},
        throws=False,
    )
コード例 #10
0
def test(writer):
    writer.write_test_file(
        'Valid',
        schema='ROUTER_HTTP_FILTER_SCHEMA',
        data=get_blob(ROUTER_HTTP_FILTER_BLOB),
        throws=False,
    )

    writer.write_test_file(
        'ValidDefaults',
        schema='ROUTER_HTTP_FILTER_SCHEMA',
        data={},
        throws=False,
    )
コード例 #11
0
def test(writer):
    
    writer.write_test_file(
        'Valid',
        schema='ROUTE_ENTRY_CONFIGURATION_SCHEMA',
        data=get_blob(ROUTE_ENTRY_CONFIGURATION_BLOB),
        throws=False,
    )

    blob = {"prefix": "/foo", "cluster": "local_service_grpc", "priority": "foo"}
    writer.write_test_file(
        'InvalidPriority',
        schema='ROUTE_ENTRY_CONFIGURATION_SCHEMA',
        data=blob,
        throws=True,
    )
コード例 #12
0
def test(writer):

    writer.write_test_file(
        'Valid',
        schema='ROUTE_ENTRY_CONFIGURATION_SCHEMA',
        data=get_blob(ROUTE_ENTRY_CONFIGURATION_BLOB),
        throws=False,
    )

    blob = {
        "prefix": "/foo",
        "cluster": "local_service_grpc",
        "priority": "foo"
    }
    writer.write_test_file(
        'InvalidPriority',
        schema='ROUTE_ENTRY_CONFIGURATION_SCHEMA',
        data=blob,
        throws=True,
    )
コード例 #13
0
def test(writer):
    
    writer.write_test_file(
        'Valid',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=get_blob(HTTP_CONN_NETWORK_FILTER_BLOB),
        throws=False,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'][1]['filter']['filters'][0]['op'] = '<'
    writer.write_test_file(
        'FilterOperatorIsNotSupportedLessThan',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'][1]['filter']['filters'][0]['op'] = '<='
    writer.write_test_file(
        'FilterOperatorIsNotSupportedLessThanEqual',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'][1]['filter']['filters'][0]['op'] = '>'
    writer.write_test_file(
        'FilterOperatorIsNotSupportedGreaterThan',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'].append({"path": "/dev/null", "filter": {"type": "unknown"}})
    writer.write_test_file(
        'FilterTypeIsNotSupported',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'].append({"path": "/dev/null", "filter": {"type": "logical_or", "filters": []}})
    writer.write_test_file(
        'LessThanTwoFiltersInListNoneLogicalOrThrows',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'].append({"path": "/dev/null", "filter": {"type": "logical_and", "filters": []}})
    writer.write_test_file(
        'LessThanTwoFiltersInListNoneLogicalAndThrows',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'].append({"path": "/dev/null", "filter": {"type": "logical_or", "filters": [{"type": "not_healthcheck"}]}})
    writer.write_test_file(
        'LessThanTwoFiltersInListOneLogicalOrThrows',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'].append({"path": "/dev/null", "filter": {"type": "logical_and", "filters": [{"type": "not_healthcheck"}]}})
    writer.write_test_file(
        'LessThanTwoFiltersInListOneLogicalAndThrows',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )
コード例 #14
0
def test(writer):
    
    writer.write_test_file(
        'Valid',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=get_blob(HTTP_CONN_NETWORK_FILTER_BLOB),
        throws=False,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'][1]['filter']['filters'][0]['op'] = '<'
    writer.write_test_file(
        'FilterOperatorIsNotSupportedLessThan',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'][1]['filter']['filters'][0]['op'] = '<='
    writer.write_test_file(
        'FilterOperatorIsNotSupportedLessThanEqual',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'][1]['filter']['filters'][0]['op'] = '>'
    writer.write_test_file(
        'FilterOperatorIsNotSupportedGreaterThan',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'].append({"path": "/dev/null", "filter": {"type": "unknown"}})
    writer.write_test_file(
        'FilterTypeIsNotSupported',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'].append({"path": "/dev/null", "filter": {"type": "logical_or", "filters": []}})
    writer.write_test_file(
        'LessThanTwoFiltersInListNoneLogicalOrThrows',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'].append({"path": "/dev/null", "filter": {"type": "logical_and", "filters": []}})
    writer.write_test_file(
        'LessThanTwoFiltersInListNoneLogicalAndThrows',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'].append({"path": "/dev/null", "filter": {"type": "logical_or", "filters": [{"type": "not_healthcheck"}]}})
    writer.write_test_file(
        'LessThanTwoFiltersInListOneLogicalOrThrows',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(HTTP_CONN_NETWORK_FILTER_BLOB)
    blob['access_log'].append({"path": "/dev/null", "filter": {"type": "logical_and", "filters": [{"type": "not_healthcheck"}]}})
    writer.write_test_file(
        'LessThanTwoFiltersInListOneLogicalAndThrows',
        schema='HTTP_CONN_NETWORK_FILTER_SCHEMA',
        data=blob,
        throws=True,
    )
コード例 #15
0
def test(writer):
    for idx, item in enumerate(ACCESS_LOG_BLOB["access_log"]):
        writer.write_test_file(
            'Valid_idx_' + str(idx),
            schema='ACCESS_LOG_SCHEMA',
            data=get_blob(item),
            throws=False,
        )

    blob = get_blob(ACCESS_LOG_BLOB)['access_log'][1]
    blob['filter']['filters'][0]['op'] = '<'
    writer.write_test_file(
        'FilterOperatorIsNotSupportedLessThan',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(ACCESS_LOG_BLOB)['access_log'][1]
    blob['filter']['filters'][0]['op'] = '<='
    writer.write_test_file(
        'FilterOperatorIsNotSupportedLessThanEqual',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(ACCESS_LOG_BLOB)['access_log'][1]
    blob['filter']['filters'][0]['op'] = '>'
    writer.write_test_file(
        'FilterOperatorIsNotSupportedGreaterThan',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = {"path": "/dev/null", "filter": {"type": "unknown"}}
    writer.write_test_file(
        'FilterTypeIsNotSupported',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = {"path": "/dev/null", "filter": {"type": "logical_or", "filters": []}}
    writer.write_test_file(
        'LessThanTwoFiltersInListNoneLogicalOrThrows',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = {"path": "/dev/null", "filter": {"type": "logical_and", "filters": []}}
    writer.write_test_file(
        'LessThanTwoFiltersInListNoneLogicalAndThrows',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = {"path": "/dev/null", "filter": {"type": "logical_or", "filters": [{"type": "not_healthcheck"}]}}
    writer.write_test_file(
        'LessThanTwoFiltersInListOneLogicalOrThrows',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = {"path": "/dev/null", "filter": {"type": "logical_and", "filters": [{"type": "not_healthcheck"}]}}
    writer.write_test_file(
        'LessThanTwoFiltersInListOneLogicalAndThrows',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )
コード例 #16
0
def test(writer):
    for idx, item in enumerate(ACCESS_LOG_BLOB["access_log"]):
        writer.write_test_file(
            'Valid_idx_' + str(idx),
            schema='ACCESS_LOG_SCHEMA',
            data=get_blob(item),
            throws=False,
        )

    blob = get_blob(ACCESS_LOG_BLOB)['access_log'][1]
    blob['filter']['filters'][0]['op'] = '<'
    writer.write_test_file(
        'FilterOperatorIsNotSupportedLessThan',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(ACCESS_LOG_BLOB)['access_log'][1]
    blob['filter']['filters'][0]['op'] = '<='
    writer.write_test_file(
        'FilterOperatorIsNotSupportedLessThanEqual',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = get_blob(ACCESS_LOG_BLOB)['access_log'][1]
    blob['filter']['filters'][0]['op'] = '>'
    writer.write_test_file(
        'FilterOperatorIsNotSupportedGreaterThan',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = {"path": "/dev/null", "filter": {"type": "unknown"}}
    writer.write_test_file(
        'FilterTypeIsNotSupported',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = {
        "path": "/dev/null",
        "filter": {
            "type": "logical_or",
            "filters": []
        }
    }
    writer.write_test_file(
        'LessThanTwoFiltersInListNoneLogicalOrThrows',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = {
        "path": "/dev/null",
        "filter": {
            "type": "logical_and",
            "filters": []
        }
    }
    writer.write_test_file(
        'LessThanTwoFiltersInListNoneLogicalAndThrows',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = {
        "path": "/dev/null",
        "filter": {
            "type": "logical_or",
            "filters": [{
                "type": "not_healthcheck"
            }]
        }
    }
    writer.write_test_file(
        'LessThanTwoFiltersInListOneLogicalOrThrows',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )

    blob = {
        "path": "/dev/null",
        "filter": {
            "type": "logical_and",
            "filters": [{
                "type": "not_healthcheck"
            }]
        }
    }
    writer.write_test_file(
        'LessThanTwoFiltersInListOneLogicalAndThrows',
        schema='ACCESS_LOG_SCHEMA',
        data=blob,
        throws=True,
    )