Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions clients/destination/v0/destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,26 @@ type Client struct {

type ClientOption func(*Client)

func WithDestinationLogger(logger zerolog.Logger) func(*Client) {
func WithLogger(logger zerolog.Logger) func(*Client) {
return func(c *Client) {
c.logger = logger
}
}

func WithDestinationDirectory(directory string) func(*Client) {
func WithDirectory(directory string) func(*Client) {
return func(c *Client) {
c.directory = directory
}
}

func WithDestinationGrpcConn(userConn *grpc.ClientConn) func(*Client) {
func WithGrpcConn(userConn *grpc.ClientConn) func(*Client) {
return func(c *Client) {
// we use a different variable here because we don't want to close a connection that wasn't created by us.
c.userConn = userConn
}
}

func WithDestinationNoSentry() func(*Client) {
func WithNoSentry() func(*Client) {
return func(c *Client) {
c.noSentry = true
}
Expand Down
4 changes: 2 additions & 2 deletions clients/destination/v0/destination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestDestinationClient(t *testing.T) {
for _, tc := range newDestinationClientTestCases {
t.Run(tc.Path+"_"+tc.Version, func(t *testing.T) {
dirName := t.TempDir()
c, err := NewClient(ctx, tc.Registry, tc.Path, tc.Version, WithDestinationLogger(l), WithDestinationDirectory(dirName))
c, err := NewClient(ctx, tc.Registry, tc.Path, tc.Version, WithLogger(l), WithDirectory(dirName))
if err != nil {
if strings.HasPrefix(err.Error(), "destination plugin protocol version") {
// this also means success as in this tests we just want to make sure we were able to download and spawn the plugin
Expand Down Expand Up @@ -69,7 +69,7 @@ func TestDestinationClientWriteReturnsCorrectError(t *testing.T) {
ctx := context.Background()
l := zerolog.New(zerolog.NewTestWriter(t)).Output(zerolog.ConsoleWriter{Out: os.Stderr}).Level(zerolog.DebugLevel)
dirName := t.TempDir()
c, err := NewClient(ctx, specs.RegistryGithub, "cloudquery/sqlite", "v1.0.11", WithDestinationLogger(l), WithDestinationDirectory(dirName))
c, err := NewClient(ctx, specs.RegistryGithub, "cloudquery/sqlite", "v1.0.11", WithLogger(l), WithDirectory(dirName))
if err != nil {
t.Fatal(err)
}
Expand Down
8 changes: 4 additions & 4 deletions clients/source/v0/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,26 @@ type FetchResultMessage struct {

type ClientOption func(*Client)

func WithSourceLogger(logger zerolog.Logger) func(*Client) {
func WithLogger(logger zerolog.Logger) func(*Client) {
return func(c *Client) {
c.logger = logger
}
}

func WithSourceDirectory(directory string) func(*Client) {
func WithDirectory(directory string) func(*Client) {
return func(c *Client) {
c.directory = directory
}
}

func WithSourceGRPCConnection(userConn *grpc.ClientConn) func(*Client) {
func WithGRPCConnection(userConn *grpc.ClientConn) func(*Client) {
return func(c *Client) {
// we use a different variable here because we don't want to close a connection that wasn't created by us.
c.userConn = userConn
}
}

func WithSourceNoSentry() func(*Client) {
func WithNoSentry() func(*Client) {
return func(c *Client) {
c.noSentry = true
}
Expand Down
2 changes: 1 addition & 1 deletion clients/source/v0/source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestSourceClient(t *testing.T) {
for _, tc := range newSourceClientTestCases {
t.Run(tc.Path+"_"+tc.Version, func(t *testing.T) {
dirName := t.TempDir()
c, err := NewClient(ctx, tc.Registry, tc.Path, tc.Version, WithSourceLogger(l), WithSourceDirectory(dirName))
c, err := NewClient(ctx, tc.Registry, tc.Path, tc.Version, WithLogger(l), WithDirectory(dirName))
if err != nil {
if strings.HasPrefix(err.Error(), "source plugin protocol version") {
// this also means success as in this tests we just want to make sure we were able to download and spawn the plugin
Expand Down
8 changes: 4 additions & 4 deletions clients/source/v1/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,26 @@ type FetchResultMessage struct {

type ClientOption func(*Client)

func WithSourceLogger(logger zerolog.Logger) func(*Client) {
func WithLogger(logger zerolog.Logger) func(*Client) {
return func(c *Client) {
c.logger = logger
}
}

func WithSourceDirectory(directory string) func(*Client) {
func WithDirectory(directory string) func(*Client) {
return func(c *Client) {
c.directory = directory
}
}

func WithSourceGRPCConnection(userConn *grpc.ClientConn) func(*Client) {
func WithGRPCConnection(userConn *grpc.ClientConn) func(*Client) {
return func(c *Client) {
// we use a different variable here because we don't want to close a connection that wasn't created by us.
c.userConn = userConn
}
}

func WithSourceNoSentry() func(*Client) {
func WithNoSentry() func(*Client) {
return func(c *Client) {
c.noSentry = true
}
Expand Down
2 changes: 1 addition & 1 deletion serve/destination_v0_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestDestination(t *testing.T) {
if err != nil {
t.Fatalf("Failed to dial bufnet: %v", err)
}
c, err := clients.NewClient(ctx, specs.RegistryGrpc, "", "", clients.WithDestinationGrpcConn(conn), clients.WithDestinationNoSentry())
c, err := clients.NewClient(ctx, specs.RegistryGrpc, "", "", clients.WithGrpcConn(conn), clients.WithNoSentry())
if err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion serve/source_v0_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestSourceSuccessV1(t *testing.T) {
if err != nil {
t.Fatalf("Failed to dial bufnet: %v", err)
}
c, err := clients.NewClient(ctx, specs.RegistryGrpc, "", "", clients.WithSourceGRPCConnection(conn), clients.WithSourceNoSentry())
c, err := clients.NewClient(ctx, specs.RegistryGrpc, "", "", clients.WithGRPCConnection(conn), clients.WithNoSentry())
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions serve/source_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestSourceSuccess(t *testing.T) {
if err != nil {
t.Fatalf("Failed to dial bufnet: %v", err)
}
c, err := clients.NewClient(ctx, specs.RegistryGrpc, "", "", clients.WithSourceGRPCConnection(conn), clients.WithSourceNoSentry())
c, err := clients.NewClient(ctx, specs.RegistryGrpc, "", "", clients.WithGRPCConnection(conn), clients.WithNoSentry())
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -266,7 +266,7 @@ func TestSourceFail(t *testing.T) {
if err != nil {
t.Fatalf("Failed to dial bufnet: %v", err)
}
c, err := clients.NewClient(ctx, specs.RegistryGrpc, "", "", clients.WithSourceGRPCConnection(conn), clients.WithSourceNoSentry())
c, err := clients.NewClient(ctx, specs.RegistryGrpc, "", "", clients.WithGRPCConnection(conn), clients.WithNoSentry())
if err != nil {
t.Fatal(err)
}
Expand Down