From 7ea2eadaa032350bb783a096e68e5df5b7890421 Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Thu, 11 Jul 2024 00:45:00 +0300 Subject: [PATCH 1/2] gripmock check --- cmd/check.go | 6 +++--- example/ms/entrypoint.sh | 2 +- example/multi-files/entrypoint.sh | 2 +- example/multi-package/entrypoint.sh | 2 +- example/one-of/entrypoint.sh | 2 +- example/simple/entrypoint.sh | 2 +- example/stream/entrypoint.sh | 2 +- example/stub-subfolders/entrypoint.sh | 2 +- example/well_known_types/entrypoint.sh | 2 +- go.mod | 2 +- internal/deps/grpc_client.go | 11 ++++------- 11 files changed, 16 insertions(+), 19 deletions(-) diff --git a/cmd/check.go b/cmd/check.go index ebd69ba9..ea3b95e2 100644 --- a/cmd/check.go +++ b/cmd/check.go @@ -36,15 +36,15 @@ var checkCmd = &cobra.Command{ return err } - status, err := pingService.PingWithTimeout(ctx, pingTimeout, serviceName) + code, err := pingService.PingWithTimeout(ctx, pingTimeout, serviceName) if err != nil { zerolog.Ctx(ctx).Err(err).Msg("unable to connect to server") return err } - if status != waiter.Serving { - zerolog.Ctx(ctx).Error().Uint32("code", uint32(status)).Msg("server is not running") + if code != waiter.Serving { + zerolog.Ctx(ctx).Error().Uint32("code", uint32(code)).Msg("server is not running") return errServerIsNotRunning } diff --git a/example/ms/entrypoint.sh b/example/ms/entrypoint.sh index 1aa38462..c48bf3c1 100755 --- a/example/ms/entrypoint.sh +++ b/example/ms/entrypoint.sh @@ -5,6 +5,6 @@ gripmock --stub=example/ms/stub example/ms/ms.proto & # wait for generated files to be available and gripmock is up -sleep 2 +gripmock check --timeout=30s go run example/ms/client/*.go \ No newline at end of file diff --git a/example/multi-files/entrypoint.sh b/example/multi-files/entrypoint.sh index fc3ac7f0..b3efb240 100755 --- a/example/multi-files/entrypoint.sh +++ b/example/multi-files/entrypoint.sh @@ -6,6 +6,6 @@ gripmock --stub=example/multi-files/stub example/multi-files/file1.proto \ example/multi-files/file2.proto & # wait for generated files to be available and gripmock is up -sleep 2 +gripmock check --timeout=30s go run example/multi-files/client/*.go \ No newline at end of file diff --git a/example/multi-package/entrypoint.sh b/example/multi-package/entrypoint.sh index d168dbb3..6233035b 100755 --- a/example/multi-package/entrypoint.sh +++ b/example/multi-package/entrypoint.sh @@ -9,6 +9,6 @@ gripmock --stub=example/multi-package/stub --imports=example/multi-package/ \ example/multi-package/foo.proto example/multi-package/hello.proto & # wait for generated files to be available and gripmock is up -sleep 2 +gripmock check --timeout=30s go run example/multi-package/client/*.go \ No newline at end of file diff --git a/example/one-of/entrypoint.sh b/example/one-of/entrypoint.sh index 44eae91e..0396d934 100755 --- a/example/one-of/entrypoint.sh +++ b/example/one-of/entrypoint.sh @@ -5,6 +5,6 @@ gripmock --stub=example/one-of/stub example/one-of/oneof.proto & # wait for generated files to be available and gripmock is up -sleep 2 +gripmock check --timeout=30s go run example/one-of/client/*.go \ No newline at end of file diff --git a/example/simple/entrypoint.sh b/example/simple/entrypoint.sh index d9977069..2ccd4a9f 100755 --- a/example/simple/entrypoint.sh +++ b/example/simple/entrypoint.sh @@ -5,6 +5,6 @@ gripmock --stub=example/simple/stub example/simple/simple.proto & # wait for generated files to be available and gripmock is up -sleep 2 +gripmock check --timeout=30s go run example/simple/client/*.go \ No newline at end of file diff --git a/example/stream/entrypoint.sh b/example/stream/entrypoint.sh index e4e180e3..e0b9f27b 100755 --- a/example/stream/entrypoint.sh +++ b/example/stream/entrypoint.sh @@ -5,6 +5,6 @@ gripmock --stub=example/stream/stub example/stream/stream.proto & # wait for generated files to be available and gripmock is up -sleep 2 +gripmock check --timeout=30s go run example/stream/client/*.go \ No newline at end of file diff --git a/example/stub-subfolders/entrypoint.sh b/example/stub-subfolders/entrypoint.sh index 73b34e69..f5969783 100755 --- a/example/stub-subfolders/entrypoint.sh +++ b/example/stub-subfolders/entrypoint.sh @@ -5,6 +5,6 @@ gripmock --stub=example/stub-subfolders/stub example/stub-subfolders/stub-subfolders.proto & # wait for generated files to be available and gripmock is up -sleep 2 +gripmock check --timeout=30s go run example/stub-subfolders/client/*.go \ No newline at end of file diff --git a/example/well_known_types/entrypoint.sh b/example/well_known_types/entrypoint.sh index bfe10827..e8082e52 100755 --- a/example/well_known_types/entrypoint.sh +++ b/example/well_known_types/entrypoint.sh @@ -5,6 +5,6 @@ gripmock --stub=example/well_known_types/stub example/well_known_types/wkt.proto & # wait for generated files to be available and gripmock is up -sleep 2 +gripmock check --timeout=30s go run example/well_known_types/client/*.go \ No newline at end of file diff --git a/go.mod b/go.mod index 26ed9fbf..cd459c05 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,6 @@ require ( github.com/rs/zerolog v1.33.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - golang.org/x/text v0.16.0 google.golang.org/genproto/googleapis/api v0.0.0-20240709173604-40e1e62336c5 google.golang.org/grpc v1.65.0 google.golang.org/protobuf v1.34.2 @@ -47,6 +46,7 @@ require ( golang.org/x/exp v0.0.0-20240707233637-46b078467d37 // indirect golang.org/x/net v0.27.0 // indirect golang.org/x/sys v0.22.0 // indirect + golang.org/x/text v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect diff --git a/internal/deps/grpc_client.go b/internal/deps/grpc_client.go index 0a1c1120..145201ef 100644 --- a/internal/deps/grpc_client.go +++ b/internal/deps/grpc_client.go @@ -7,14 +7,11 @@ import ( "google.golang.org/grpc/credentials/insecure" ) -func (b *Builder) dialOptions(_ bool) []grpc.DialOption { - return []grpc.DialOption{ +func (b *Builder) grpcClientConn(_ bool, dsn string) (*grpc.ClientConn, error) { + conn, err := grpc.NewClient( + dsn, grpc.WithTransportCredentials(insecure.NewCredentials()), - } -} - -func (b *Builder) grpcClientConn(tls bool, dsn string) (*grpc.ClientConn, error) { - conn, err := grpc.NewClient(dsn, b.dialOptions(tls)...) + ) if err != nil { return nil, err } From a6816057b445e1b8c562d9656ea0adda5cac32eb Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Thu, 11 Jul 2024 00:49:49 +0300 Subject: [PATCH 2/2] update go.mod&go.sum --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index cd459c05..3a6cf1b3 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.22.2 require ( github.com/bavix/features v1.0.0 github.com/bavix/gripmock-sdk-go v1.0.4 - github.com/bavix/gripmock-ui v1.0.0-alpha5 - github.com/bavix/gripmock/protogen v0.0.0-20240707160904-f1a1ccbfe8b6 + github.com/bavix/gripmock-ui v1.0.0-alpha6 + github.com/bavix/gripmock/protogen v0.0.0-20240709053640-e0d876e2e696 github.com/cristalhq/base64 v0.1.2 github.com/goccy/go-yaml v1.11.3 github.com/google/uuid v1.6.0 diff --git a/go.sum b/go.sum index e839c329..e9eed24b 100644 --- a/go.sum +++ b/go.sum @@ -5,10 +5,10 @@ github.com/bavix/features v1.0.0 h1:KyJzP1aKdTWSO7RxwX0Hega9qHUrSdiwdhI+uhAjUg4= github.com/bavix/features v1.0.0/go.mod h1:OLOA0UEsGMPY0Ofc/4kjajVB/H1zvITPAegB9RkewqM= github.com/bavix/gripmock-sdk-go v1.0.4 h1:FDBlusqVFoy5Yo49khztYqfVt9+NSEf1mIl1nQWoTr4= github.com/bavix/gripmock-sdk-go v1.0.4/go.mod h1:/1cmn8VuN6Pc7ttMejqXLYpvf1CJF08ezoEA9lJIZiU= -github.com/bavix/gripmock-ui v1.0.0-alpha5 h1:+2vWLZPeGGrpBSENWXIfyf6bwN+Pou+XucX0XlccLQo= -github.com/bavix/gripmock-ui v1.0.0-alpha5/go.mod h1:XEH4YYEKL+wEDtONntoWm6JxjbVWzl7XtDYztUTBfeA= -github.com/bavix/gripmock/protogen v0.0.0-20240707160904-f1a1ccbfe8b6 h1:VmSRk5/9OK0MVjBS56wvXVGB5Vpc00Ex4KR0MM+qabo= -github.com/bavix/gripmock/protogen v0.0.0-20240707160904-f1a1ccbfe8b6/go.mod h1:ARIfXpB9cyL9jIr7C1yrhwnb3wCSrewPNLdyG4URmJk= +github.com/bavix/gripmock-ui v1.0.0-alpha6 h1:fgDg/R6MLmrpKtR9Rn2a9DEq8qpfjG0OMhRnU72uSR4= +github.com/bavix/gripmock-ui v1.0.0-alpha6/go.mod h1:XEH4YYEKL+wEDtONntoWm6JxjbVWzl7XtDYztUTBfeA= +github.com/bavix/gripmock/protogen v0.0.0-20240709053640-e0d876e2e696 h1:QIOhL5eLnASn6XB4bN9ip/UbxhG/PcEjeHufRsZj30M= +github.com/bavix/gripmock/protogen v0.0.0-20240709053640-e0d876e2e696/go.mod h1:ARIfXpB9cyL9jIr7C1yrhwnb3wCSrewPNLdyG4URmJk= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= github.com/bufbuild/protocompile v0.14.0 h1:z3DW4IvXE5G/uTOnSQn+qwQQxvhckkTWLS/0No/o7KU= github.com/bufbuild/protocompile v0.14.0/go.mod h1:N6J1NYzkspJo3ZwyL4Xjvli86XOj1xq4qAasUFxGups=