Skip to content

Commit

Permalink
Update deprecated grpc.WithInsecure()
Browse files Browse the repository at this point in the history
  • Loading branch information
simitt committed Jan 26, 2022
1 parent 32f16ae commit f1abcb9
Show file tree
Hide file tree
Showing 11 changed files with 331 additions and 16 deletions.
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1270,11 +1270,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
Dependency : github.com/google/pprof
Version: v0.0.0-20210609004039-a478d1d731e9
Version: v0.0.0-20210720184732-4bb14d4b1be1
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/google/[email protected]20210609004039-a478d1d731e9/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/google/[email protected]20210720184732-4bb14d4b1be1/LICENSE:


Apache License
Expand Down
3 changes: 2 additions & 1 deletion beater/jaeger/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"go.opentelemetry.io/collector/model/pdata"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"

"github.com/elastic/beats/v7/libbeat/common"
Expand Down Expand Up @@ -258,7 +259,7 @@ func newServer(t *testing.T, batchProcessor model.BatchProcessor, agentcfgFetche

go srv.Serve(lis)
t.Cleanup(srv.GracefulStop)
conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure())
conn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
t.Cleanup(func() { conn.Close() })
return conn
Expand Down
3 changes: 2 additions & 1 deletion beater/otlp/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"go.opentelemetry.io/collector/model/otlpgrpc"
"go.opentelemetry.io/collector/model/pdata"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"

"github.com/elastic/apm-server/beater/interceptors"
Expand Down Expand Up @@ -192,7 +193,7 @@ func newServer(t *testing.T, batchProcessor model.BatchProcessor) *grpc.ClientCo

go srv.Serve(lis)
t.Cleanup(srv.GracefulStop)
conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure())
conn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
t.Cleanup(func() { conn.Close() })
return conn
Expand Down
5 changes: 3 additions & 2 deletions beater/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"

Expand Down Expand Up @@ -404,7 +405,7 @@ func TestServerJaegerGRPC(t *testing.T) {

baseURL, err := url.Parse(server.baseURL)
require.NoError(t, err)
conn, err := grpc.Dial(baseURL.Host, grpc.WithInsecure())
conn, err := grpc.Dial(baseURL.Host, grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
defer conn.Close()

Expand Down Expand Up @@ -434,7 +435,7 @@ func TestServerOTLPGRPC(t *testing.T) {
return conn.Invoke(ctx, "/opentelemetry.proto.collector.trace.v1.TraceService/Export", request, response)
}

conn, err := grpc.Dial(baseURL.Host, grpc.WithInsecure())
conn, err := grpc.Dial(baseURL.Host, grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
defer conn.Close()

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/go-sourcemap/sourcemap v2.1.3+incompatible
github.com/gofrs/uuid v4.2.0+incompatible
github.com/gogo/protobuf v1.3.2
github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/golang-lru v0.5.4
Expand Down
311 changes: 310 additions & 1 deletion go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion systemtest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/elastic/apm-server/approvaltest v0.0.0-00010101000000-000000000000
github.com/elastic/go-elasticsearch/v8 v8.0.0-20211026132249-f55eeca23be5
github.com/gofrs/uuid v4.1.0+incompatible
github.com/google/pprof v0.0.0-20210406223550-17a10ee72223
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1
github.com/jaegertracing/jaeger v1.18.1
github.com/mitchellh/mapstructure v1.1.2
github.com/stretchr/testify v1.7.0
Expand Down
4 changes: 2 additions & 2 deletions systemtest/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OI
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20210406223550-17a10ee72223 h1:P/57BP4StLsl2u/YPB7CXWwvwq3RMbt0SBjrtoRcivI=
github.com/google/pprof v0.0.0-20210406223550-17a10ee72223/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand Down
7 changes: 4 additions & 3 deletions systemtest/jaeger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"

"github.com/elastic/apm-server/systemtest"
Expand All @@ -44,7 +45,7 @@ func TestJaegerGRPCMuxed(t *testing.T) {
srv := apmservertest.NewUnstartedServer(t)
srv.Config.Monitoring = newFastMonitoringConfig()
require.NoError(t, srv.Start())
testJaegerGRPC(t, srv, serverAddr(srv), grpc.WithInsecure())
testJaegerGRPC(t, srv, serverAddr(srv), grpc.WithTransportCredentials(insecure.NewCredentials()))
}

func TestJaegerGRPCMuxedTLS(t *testing.T) {
Expand Down Expand Up @@ -83,7 +84,7 @@ func TestJaegerGRPCSampling(t *testing.T) {
err := srv.Start()
require.NoError(t, err)

conn, err := grpc.Dial(serverAddr(srv), grpc.WithInsecure())
conn, err := grpc.Dial(serverAddr(srv), grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
defer conn.Close()

Expand All @@ -101,7 +102,7 @@ func TestJaegerGRPCAuth(t *testing.T) {
srv.Config.AgentAuth.SecretToken = "secret"
require.NoError(t, srv.Start())

conn, err := grpc.Dial(serverAddr(srv), grpc.WithInsecure())
conn, err := grpc.Dial(serverAddr(srv), grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
defer conn.Close()

Expand Down
3 changes: 2 additions & 1 deletion systemtest/logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
"go.uber.org/zap/zapcore"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"github.com/elastic/apm-server/systemtest"
"github.com/elastic/apm-server/systemtest/apmservertest"
Expand All @@ -45,7 +46,7 @@ func TestAPMServerGRPCRequestLoggingValid(t *testing.T) {
err := srv.Start()
require.NoError(t, err)
addr := serverAddr(srv)
conn, err := grpc.Dial(addr, grpc.WithInsecure())
conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
defer conn.Close()

Expand Down
3 changes: 2 additions & 1 deletion systemtest/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (
"golang.org/x/sync/errgroup"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"

"github.com/elastic/apm-server/systemtest"
Expand Down Expand Up @@ -145,7 +146,7 @@ func TestOTLPGRPCLogs(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

conn, err := grpc.Dial(serverAddr(srv), grpc.WithInsecure(), grpc.WithBlock())
conn, err := grpc.Dial(serverAddr(srv), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
require.NoError(t, err)
defer conn.Close()

Expand Down

0 comments on commit f1abcb9

Please sign in to comment.