format all python files in envoy (#5422)

Signed-off-by: Derek Schaller <dschaller@lyft.com>

Mirrored from https://github.com/envoyproxy/envoy @ 3499e9bdd9e35ff311a760e93b474241a79b7401
pull/620/head
data-plane-api(CircleCI) 6 years ago
parent 1e7a3052d1
commit 1c3d9d4a5c
  1. 9
      tools/capture2pcap.py
  2. 3
      tools/capture2pcap_test.py
  3. 6
      tools/generate_listeners.py
  4. 8
      tools/generate_listeners_test.py

@ -34,14 +34,9 @@ def DumpEvent(direction, timestamp, data):
dump = StringIO.StringIO()
dump.write('%s\n' % direction)
# Adjust to local timezone
adjusted_dt = timestamp.ToDatetime() - datetime.timedelta(
seconds=time.altzone)
adjusted_dt = timestamp.ToDatetime() - datetime.timedelta(seconds=time.altzone)
dump.write('%s\n' % adjusted_dt)
od = sp.Popen(
['od', '-Ax', '-tx1', '-v'],
stdout=sp.PIPE,
stdin=sp.PIPE,
stderr=sp.PIPE)
od = sp.Popen(['od', '-Ax', '-tx1', '-v'], stdout=sp.PIPE, stdin=sp.PIPE, stderr=sp.PIPE)
packet_dump = od.communicate(data)[0]
dump.write(packet_dump)
return dump.getvalue()

@ -16,8 +16,7 @@ if __name__ == '__main__':
pcap_path = os.path.join(os.getenv('TEST_TMPDIR'), 'generated.pcap')
capture2pcap.Capture2Pcap(capture_path, pcap_path)
actual_output = sp.check_output(
['tshark', '-r', pcap_path, '-d', 'tcp.port==10000,http2', '-P'])
actual_output = sp.check_output(['tshark', '-r', pcap_path, '-d', 'tcp.port==10000,http2', '-P'])
with open(expected_path, 'r') as f:
expected_output = f.read()
if actual_output != expected_output:

@ -32,8 +32,7 @@ def ProtoToStruct(proto):
def ParseProto(path, filter_name):
# We only know about some filter config protos ahead of time.
KNOWN_FILTERS = {
'http_connection_manager':
lambda: http_connection_manager_pb2.HttpConnectionManager()
'http_connection_manager': lambda: http_connection_manager_pb2.HttpConnectionManager()
}
filter_config = KNOWN_FILTERS[filter_name]()
with open(path, 'r') as f:
@ -41,8 +40,7 @@ def ParseProto(path, filter_name):
return filter_config
def GenerateListeners(listeners_pb_path, output_pb_path, output_json_path,
fragments):
def GenerateListeners(listeners_pb_path, output_pb_path, output_json_path, fragments):
listener = lds_pb2.Listener()
with open(listeners_pb_path, 'r') as f:
text_format.Merge(f.read(), listener)

@ -7,9 +7,5 @@ import generate_listeners
if __name__ == "__main__":
srcdir = os.path.join(os.getenv("TEST_SRCDIR"), 'envoy_api')
generate_listeners.GenerateListeners(
os.path.join(srcdir, "examples/service_envoy/listeners.pb"),
"/dev/stdout", "/dev/stdout",
iter([
os.path.join(srcdir,
"examples/service_envoy/http_connection_manager.pb")
]))
os.path.join(srcdir, "examples/service_envoy/listeners.pb"), "/dev/stdout", "/dev/stdout",
iter([os.path.join(srcdir, "examples/service_envoy/http_connection_manager.pb")]))

Loading…
Cancel
Save