mirror of
https://github.com/fullstorydev/grpcurl.git
synced 2026-05-22 19:51:44 +03:00
With 1.4.0 the golang/protobuf json testing protofiles are being moved to [an internal package][1]. While this is technically a breaking change, I doubt the maintainers are going to reintroduce it, so I've copied the necessary parts to our own testing protofile. This allows users of this package and, more importantly, grpcui to try 1.4.0 without this package having to migrate yet. When it comes to migrating to 1.4.0, this should also make the transition easier. [1]: https://github.com/golang/protobuf/tree/v1.4.0-rc.4/internal/testprotos
58 lines
1.4 KiB
Bash
Executable File
58 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
cd "$(dirname $0)"
|
|
|
|
# Run this script to generate files used by tests.
|
|
|
|
echo "Creating protosets..."
|
|
protoc testing/test.proto \
|
|
--include_imports \
|
|
--descriptor_set_out=testing/test.protoset
|
|
|
|
protoc testing/example.proto \
|
|
--include_imports \
|
|
--descriptor_set_out=testing/example.protoset
|
|
|
|
protoc testing/jsonpb_test_proto/test_objects.proto \
|
|
--go_out=paths=source_relative:.
|
|
|
|
echo "Creating certs for TLS testing..."
|
|
if ! hash certstrap 2>/dev/null; then
|
|
# certstrap not found: try to install it
|
|
go get github.com/square/certstrap
|
|
go install github.com/square/certstrap
|
|
fi
|
|
|
|
function cs() {
|
|
certstrap --depot-path testing/tls "$@" --passphrase ""
|
|
}
|
|
|
|
rm -rf testing/tls
|
|
|
|
# Create CA
|
|
cs init --years 10 --common-name ca
|
|
|
|
# Create client cert
|
|
cs request-cert --common-name client
|
|
cs sign client --years 10 --CA ca
|
|
|
|
# Create server cert
|
|
cs request-cert --common-name server --ip 127.0.0.1 --domain localhost
|
|
cs sign server --years 10 --CA ca
|
|
|
|
# Create another server cert for error testing
|
|
cs request-cert --common-name other --ip 1.2.3.4 --domain foobar.com
|
|
cs sign other --years 10 --CA ca
|
|
|
|
# Create another CA and client cert for more
|
|
# error testing
|
|
cs init --years 10 --common-name wrong-ca
|
|
cs request-cert --common-name wrong-client
|
|
cs sign wrong-client --years 10 --CA wrong-ca
|
|
|
|
# Create expired cert
|
|
cs request-cert --common-name expired --ip 127.0.0.1 --domain localhost
|
|
cs sign expired --years 0 --CA ca
|