Moving from govendor to dep, updated dependencies (#48)

* Moving from govendor to dep.

* Making the pull request template more friendly.

* Fixing akward space in PR template.

* goimports run on whole project using ` goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./gen-go/*")`

source of command: https://gist.github.com/bgentry/fd1ffef7dbde01857f66
This commit is contained in:
Renan DelValle 2018-01-07 13:13:47 -08:00 committed by GitHub
parent 9631aa3aab
commit 8d445c1c77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2186 changed files with 400410 additions and 352 deletions

View file

@ -0,0 +1,28 @@
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
EXTRA_DIST = \
local_thrift \
index.html \
container_limit.py \
index.html \
known_failures_Linux.json \
Makefile.am \
string_limit.py \
tests.json \
theader_binary.py \
setup.cfg \
util.py

View file

@ -0,0 +1,72 @@
#!/usr/bin/env python
import argparse
import sys
from util import add_common_args, init_protocol
from local_thrift import thrift # noqa
from thrift.Thrift import TMessageType, TType
# TODO: generate from ThriftTest.thrift
def test_list(proto, value):
method_name = 'testList'
ttype = TType.LIST
etype = TType.I32
proto.writeMessageBegin(method_name, TMessageType.CALL, 3)
proto.writeStructBegin(method_name + '_args')
proto.writeFieldBegin('thing', ttype, 1)
proto.writeListBegin(etype, len(value))
for e in value:
proto.writeI32(e)
proto.writeListEnd()
proto.writeFieldEnd()
proto.writeFieldStop()
proto.writeStructEnd()
proto.writeMessageEnd()
proto.trans.flush()
_, mtype, _ = proto.readMessageBegin()
assert mtype == TMessageType.REPLY
proto.readStructBegin()
_, ftype, fid = proto.readFieldBegin()
assert fid == 0
assert ftype == ttype
etype2, len2 = proto.readListBegin()
assert etype == etype2
assert len2 == len(value)
for i in range(len2):
v = proto.readI32()
assert v == value[i]
proto.readListEnd()
proto.readFieldEnd()
_, ftype, _ = proto.readFieldBegin()
assert ftype == TType.STOP
proto.readStructEnd()
proto.readMessageEnd()
def main(argv):
p = argparse.ArgumentParser()
add_common_args(p)
p.add_argument('--limit', type=int)
args = p.parse_args()
proto = init_protocol(args)
# TODO: test set and map
test_list(proto, list(range(args.limit - 1)))
test_list(proto, list(range(args.limit - 1)))
print('[OK]: limit - 1')
test_list(proto, list(range(args.limit)))
test_list(proto, list(range(args.limit)))
print('[OK]: just limit')
try:
test_list(proto, list(range(args.limit + 1)))
except:
print('[OK]: limit + 1')
else:
print('[ERROR]: limit + 1')
assert False
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))

View file

@ -0,0 +1,51 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Apache Thrift - integration test suite</title>
<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.4/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf-8" src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.datatables.net/1.10.4/js/jquery.dataTables.js"></script>
<script src="../result.js">
</script>
</head>
<body>
<h2>Apache Thrift - integration test suite: Results</h2>
<table id="test_results" class="display">
<thead>
<tr>
<th>Server</th>
<th>Client</th>
<th>Protocol</th>
<th>Transport</th>
<th>Result (log)</th>
<th>Expected</th>
</tr>
</thead>
</table>
<h2>Test Information</h2>
<pre id="test_info"></pre>
<a href="log">browse raw log files</a>
</body>
</html>

View file

@ -0,0 +1,36 @@
[
"c_glib-limit_container_length_binary_buffered-ip",
"c_glib-limit_string_length_binary_buffered-ip",
"csharp-limit_container_length_binary_buffered-ip",
"csharp-limit_container_length_compact_buffered-ip",
"csharp-limit_string_length_binary_buffered-ip",
"csharp-limit_string_length_compact_buffered-ip",
"d-limit_container_length_binary_buffered-ip",
"d-limit_container_length_compact_buffered-ip",
"d-limit_string_length_binary_buffered-ip",
"d-limit_string_length_compact_buffered-ip",
"erl-limit_container_length_binary_buffered-ip",
"erl-limit_container_length_compact_buffered-ip",
"erl-limit_string_length_binary_buffered-ip",
"erl-limit_string_length_compact_buffered-ip",
"go-limit_container_length_binary_buffered-ip",
"go-limit_container_length_compact_buffered-ip",
"go-limit_string_length_binary_buffered-ip",
"go-limit_string_length_compact_buffered-ip",
"hs-limit_container_length_binary_buffered-ip",
"hs-limit_container_length_compact_buffered-ip",
"hs-limit_string_length_binary_buffered-ip",
"hs-limit_string_length_compact_buffered-ip",
"nodejs-limit_container_length_binary_buffered-ip",
"nodejs-limit_container_length_compact_buffered-ip",
"nodejs-limit_string_length_binary_buffered-ip",
"nodejs-limit_string_length_compact_buffered-ip",
"perl-limit_container_length_binary_buffered-ip",
"perl-limit_string_length_binary_buffered-ip",
"rb-limit_container_length_accel-binary_buffered-ip",
"rb-limit_container_length_binary_buffered-ip",
"rb-limit_container_length_compact_buffered-ip",
"rb-limit_string_length_accel-binary_buffered-ip",
"rb-limit_string_length_binary_buffered-ip",
"rb-limit_string_length_compact_buffered-ip"
]

View file

@ -0,0 +1,32 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
import glob
import os
import sys
_SCRIPT_DIR = os.path.realpath(os.path.dirname(__file__))
_ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(_SCRIPT_DIR)))
_LIBDIR = os.path.join(_ROOT_DIR, 'lib', 'py', 'build', 'lib.*')
for libpath in glob.glob(_LIBDIR):
if libpath.endswith('-%d.%d' % (sys.version_info[0], sys.version_info[1])):
sys.path.insert(0, libpath)
thrift = __import__('thrift')
break

View file

@ -0,0 +1,2 @@
[flake8]
max-line-length = 100

View file

@ -0,0 +1,61 @@
#!/usr/bin/env python
import argparse
import sys
from util import add_common_args, init_protocol
from local_thrift import thrift # noqa
from thrift.Thrift import TMessageType, TType
# TODO: generate from ThriftTest.thrift
def test_string(proto, value):
method_name = 'testString'
ttype = TType.STRING
proto.writeMessageBegin(method_name, TMessageType.CALL, 3)
proto.writeStructBegin(method_name + '_args')
proto.writeFieldBegin('thing', ttype, 1)
proto.writeString(value)
proto.writeFieldEnd()
proto.writeFieldStop()
proto.writeStructEnd()
proto.writeMessageEnd()
proto.trans.flush()
_, mtype, _ = proto.readMessageBegin()
assert mtype == TMessageType.REPLY
proto.readStructBegin()
_, ftype, fid = proto.readFieldBegin()
assert fid == 0
assert ftype == ttype
result = proto.readString()
proto.readFieldEnd()
_, ftype, _ = proto.readFieldBegin()
assert ftype == TType.STOP
proto.readStructEnd()
proto.readMessageEnd()
assert value == result
def main(argv):
p = argparse.ArgumentParser()
add_common_args(p)
p.add_argument('--limit', type=int)
args = p.parse_args()
proto = init_protocol(args)
test_string(proto, 'a' * (args.limit - 1))
test_string(proto, 'a' * (args.limit - 1))
print('[OK]: limit - 1')
test_string(proto, 'a' * args.limit)
test_string(proto, 'a' * args.limit)
print('[OK]: just limit')
try:
test_string(proto, 'a' * (args.limit + 1))
except:
print('[OK]: limit + 1')
else:
print('[ERROR]: limit + 1')
assert False
if __name__ == '__main__':
main(sys.argv[1:])

View file

@ -0,0 +1,94 @@
[
{
"description": "THeader detects unframed binary wire format",
"name": "theader_unframed_binary",
"command": [
"python",
"theader_binary.py",
"--override-protocol=binary",
"--override-transport=buffered"
],
"protocols": ["header"],
"transports": ["buffered"],
"sockets": ["ip"],
"workdir": "features"
},
{
"description": "THeader detects framed binary wire format",
"name": "theader_framed_binary",
"command": [
"python",
"theader_binary.py",
"--override-protocol=binary",
"--override-transport=framed"
],
"protocols": ["header"],
"transports": ["buffered"],
"sockets": ["ip"],
"workdir": "features"
},
{
"description": "THeader detects unframed compact wire format",
"name": "theader_unframed_compact",
"command": [
"python",
"theader_binary.py",
"--override-protocol=compact",
"--override-transport=buffered"
],
"protocols": ["header"],
"transports": ["buffered"],
"sockets": ["ip"],
"workdir": "features"
},
{
"description": "THeader detects framed compact wire format",
"name": "theader_framed_compact",
"command": [
"python",
"theader_binary.py",
"--override-protocol=compact",
"--override-transport=framed"
],
"protocols": ["header"],
"transports": ["buffered"],
"sockets": ["ip"],
"workdir": "features"
},
{
"name": "limit_string_length",
"command": [
"python",
"string_limit.py",
"--limit=50"
],
"remote_args": [
"--string-limit=50"
],
"protocols": [
"binary",
"compact"
],
"transports": ["buffered"],
"sockets": ["ip"],
"workdir": "features"
},
{
"name": "limit_container_length",
"command": [
"python",
"container_limit.py",
"--limit=50"
],
"remote_args": [
"--container-limit=50"
],
"protocols": [
"binary",
"compact"
],
"transports": ["buffered"],
"sockets": ["ip"],
"workdir": "features"
}
]

View file

@ -0,0 +1,70 @@
#!/usr/bin/env python
import argparse
import socket
import sys
from util import add_common_args
from local_thrift import thrift # noqa
from thrift.Thrift import TMessageType, TType
from thrift.transport.TSocket import TSocket
from thrift.transport.TTransport import TBufferedTransport, TFramedTransport
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
from thrift.protocol.TCompactProtocol import TCompactProtocol
def test_void(proto):
proto.writeMessageBegin('testVoid', TMessageType.CALL, 3)
proto.writeStructBegin('testVoid_args')
proto.writeFieldStop()
proto.writeStructEnd()
proto.writeMessageEnd()
proto.trans.flush()
_, mtype, _ = proto.readMessageBegin()
assert mtype == TMessageType.REPLY
proto.readStructBegin()
_, ftype, _ = proto.readFieldBegin()
assert ftype == TType.STOP
proto.readStructEnd()
proto.readMessageEnd()
# THeader stack should accept binary protocol with optionally framed transport
def main(argv):
p = argparse.ArgumentParser()
add_common_args(p)
# Since THeaderTransport acts as framed transport when detected frame, we
# cannot use --transport=framed as it would result in 2 layered frames.
p.add_argument('--override-transport')
p.add_argument('--override-protocol')
args = p.parse_args()
assert args.protocol == 'header'
assert args.transport == 'buffered'
assert not args.ssl
sock = TSocket(args.host, args.port, socket_family=socket.AF_INET)
if not args.override_transport or args.override_transport == 'buffered':
trans = TBufferedTransport(sock)
elif args.override_transport == 'framed':
print('TFRAMED')
trans = TFramedTransport(sock)
else:
raise ValueError('invalid transport')
trans.open()
if not args.override_protocol or args.override_protocol == 'binary':
proto = TBinaryProtocol(trans)
elif args.override_protocol == 'compact':
proto = TCompactProtocol(trans)
else:
raise ValueError('invalid transport')
test_void(proto)
test_void(proto)
trans.close()
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))

40
vendor/git.apache.org/thrift.git/test/features/util.py generated vendored Normal file
View file

@ -0,0 +1,40 @@
import argparse
import socket
from local_thrift import thrift # noqa
from thrift.transport.TSocket import TSocket
from thrift.transport.TTransport import TBufferedTransport, TFramedTransport
from thrift.transport.THttpClient import THttpClient
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
from thrift.protocol.TCompactProtocol import TCompactProtocol
from thrift.protocol.TJSONProtocol import TJSONProtocol
def add_common_args(p):
p.add_argument('--host', default='localhost')
p.add_argument('--port', type=int, default=9090)
p.add_argument('--protocol', default='binary')
p.add_argument('--transport', default='buffered')
p.add_argument('--ssl', action='store_true')
def parse_common_args(argv):
p = argparse.ArgumentParser()
add_common_args(p)
return p.parse_args(argv)
def init_protocol(args):
sock = TSocket(args.host, args.port, socket_family=socket.AF_INET)
sock.setTimeout(500)
trans = {
'buffered': TBufferedTransport,
'framed': TFramedTransport,
'http': THttpClient,
}[args.transport](sock)
trans.open()
return {
'binary': TBinaryProtocol,
'compact': TCompactProtocol,
'json': TJSONProtocol,
}[args.protocol](trans)