Files
Joe Elliott fc6c5c063f dep => go mod (#1062)
* go mod files added.  dep removed

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Magically got prometheus version to stick

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Cortex updated and prometheus updated

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Updated prometheus dependency

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added additional deps

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added two replaces from Gopkg.toml.  Tests passing

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added deps

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Updated build image to 1.12

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Updated golangci-lint to use vendored dependencies

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added check-mod makefile step and referenced in drone and circle ci configs

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Updated loki-build-image to 1.12

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Fixed linting error.  Force go111module on for linting

Signed-off-by: Joe Elliott <number101010@gmail.com>

* go mod vendor

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Forced the inclusion of modtimevfs

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Pin client-go due to issue with v12 go.mod

Signed-off-by: Joe Elliott <number101010@gmail.com>

* go mod tidy

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added check-mod to drone

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Re-readded correct golang client

Signed-off-by: Joe Elliott <number101010@gmail.com>

* go mod tidy

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Pinned golang/x/net to avoid proxy errors

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Removed check-mod from all.  Not necessary for tests

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Updated go.sum to match new pin

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Upgraded proto to match build image

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Force check-mod to wait til after test and lint are successful

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added mod vendor to go builds to force usage of vendored dependencies

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Turn on gomodules on all builds

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Revert "Added mod vendor to go builds to force usage of vendored dependencies"

This reverts commit 65865a24c9a23133e0fa52942f2828ead7c22147.

* Moved builds out of the gopath to enforce vendor usage

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Revert "Turn on gomodules on all builds"

This reverts commit b5847f0158e928e935e0b3c1b1d4eaba840ca3dc.

* Explicitly choose build image for docker driver

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Updated golang.org/x/sys to match prometheus's version to fix promtail windows compilation

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added fluentbit dependency

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added dependency management clause

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Updated go version in contributing

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added phony makefile targets

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Circle CI is increasingly failing linting

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Force vendored deps on builds

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added logcli to gitignore

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Reduced concurrency to help CircleCI

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Moved drone builds out of GOPATH to force use of go module

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added mod vendor to prevent go clean from redownloading all packages

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added to test as well

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added mod-vendor to final go commands

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Moved fluent-bit out of GO_PATH to force go modules

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Pass mod vendor to the last holdout:  go generate

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Updated ugorji/go to 1.17 to avoid version regression

Signed-off-by: Joe Elliott <number101010@gmail.com>

* go mod tidy and go mod vendor for ugorji/go

Signed-off-by: Joe Elliott <number101010@gmail.com>
2019-09-30 08:37:27 -04:00

127 lines
3.9 KiB
Python

#!/usr/bin/env python
# This will create golden files in a directory passed to it.
# A Test calls this internally to create the golden files
# So it can process them (so we don't have to checkin the files).
# Ensure msgpack-python and cbor are installed first, using:
# sudo apt-get install python-dev
# sudo apt-get install python-pip
# pip install --user msgpack-python msgpack-rpc-python cbor
# Ensure all "string" keys are utf strings (else encoded as bytes)
import cbor, msgpack, msgpackrpc, sys, os, threading
def get_test_data_list():
# get list with all primitive types, and a combo type
l0 = [
-8,
-1616,
-32323232,
-6464646464646464,
192,
1616,
32323232,
6464646464646464,
192,
-3232.0,
-6464646464.0,
3232.0,
6464.0,
6464646464.0,
False,
True,
u"null",
None,
u"some&day>some<day",
1328176922000002000,
u"",
-2206187877999998000,
u"bytestring",
270,
u"none",
-2013855847999995777,
#-6795364578871345152,
]
l1 = [
{ "true": True,
"false": False },
{ "true": u"True",
"false": False,
"uint16(1616)": 1616 },
{ "list": [1616, 32323232, True, -3232.0, {"TRUE":True, "FALSE":False}, [True, False] ],
"int32":32323232, "bool": True,
"LONG STRING": u"123456789012345678901234567890123456789012345678901234567890",
"SHORT STRING": u"1234567890" },
{ True: "true", 138: False, "false": 200 }
]
l = []
l.extend(l0)
l.append(l0)
l.append(1)
l.extend(l1)
return l
def build_test_data(destdir):
l = get_test_data_list()
for i in range(len(l)):
# packer = msgpack.Packer()
serialized = msgpack.dumps(l[i])
f = open(os.path.join(destdir, str(i) + '.msgpack.golden'), 'wb')
f.write(serialized)
f.close()
serialized = cbor.dumps(l[i])
f = open(os.path.join(destdir, str(i) + '.cbor.golden'), 'wb')
f.write(serialized)
f.close()
def doRpcServer(port, stopTimeSec):
class EchoHandler(object):
def Echo123(self, msg1, msg2, msg3):
return ("1:%s 2:%s 3:%s" % (msg1, msg2, msg3))
def EchoStruct(self, msg):
return ("%s" % msg)
addr = msgpackrpc.Address('127.0.0.1', port)
server = msgpackrpc.Server(EchoHandler())
server.listen(addr)
# run thread to stop it after stopTimeSec seconds if > 0
if stopTimeSec > 0:
def myStopRpcServer():
server.stop()
t = threading.Timer(stopTimeSec, myStopRpcServer)
t.start()
server.start()
def doRpcClientToPythonSvc(port):
address = msgpackrpc.Address('127.0.0.1', port)
client = msgpackrpc.Client(address, unpack_encoding='utf-8')
print client.call("Echo123", "A1", "B2", "C3")
print client.call("EchoStruct", {"A" :"Aa", "B":"Bb", "C":"Cc"})
def doRpcClientToGoSvc(port):
# print ">>>> port: ", port, " <<<<<"
address = msgpackrpc.Address('127.0.0.1', port)
client = msgpackrpc.Client(address, unpack_encoding='utf-8')
print client.call("TestRpcInt.Echo123", ["A1", "B2", "C3"])
print client.call("TestRpcInt.EchoStruct", {"A" :"Aa", "B":"Bb", "C":"Cc"})
def doMain(args):
if len(args) == 2 and args[0] == "testdata":
build_test_data(args[1])
elif len(args) == 3 and args[0] == "rpc-server":
doRpcServer(int(args[1]), int(args[2]))
elif len(args) == 2 and args[0] == "rpc-client-python-service":
doRpcClientToPythonSvc(int(args[1]))
elif len(args) == 2 and args[0] == "rpc-client-go-service":
doRpcClientToGoSvc(int(args[1]))
else:
print("Usage: test.py " +
"[testdata|rpc-server|rpc-client-python-service|rpc-client-go-service] ...")
if __name__ == "__main__":
doMain(sys.argv[1:])