Skip to content

Commit

Permalink
gripmock check
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Jul 10, 2024
1 parent d76e86c commit 7ea2ead
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 19 deletions.
6 changes: 3 additions & 3 deletions cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion example/ms/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion example/multi-files/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion example/multi-package/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion example/one-of/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion example/simple/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion example/stream/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion example/stub-subfolders/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion example/well_known_types/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 4 additions & 7 deletions internal/deps/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 7ea2ead

Please sign in to comment.