Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add tests to ExecuteWithClient for pipelines cmds #2111

Merged
merged 27 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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 cmd/conduit/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (
)

type Client struct {
conn *grpc.ClientConn
apiv1.PipelineServiceClient
apiv1.ProcessorServiceClient
apiv1.ConnectorServiceClient
conn *grpc.ClientConn
PipelineServiceClient PipelineService
ConnectorServiceClient ConnectorService
ProcessorServiceClient ProcessorService
healthgrpc.HealthClient
}

Expand Down
103 changes: 103 additions & 0 deletions cmd/conduit/api/mock/connector_service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 103 additions & 0 deletions cmd/conduit/api/mock/pipeline_service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 103 additions & 0 deletions cmd/conduit/api/mock/processor_service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions cmd/conduit/api/services.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright © 2025 Meroxa, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package api

import (
"context"

apiv1 "github.com/conduitio/conduit/proto/api/v1"
"google.golang.org/grpc"
)

//go:generate mockgen -destination=mock/connector_service.go -package=mock . ConnectorService

// ConnectorService defines the methods of the ConnectorServiceClient that are currently used by the CLI.
type ConnectorService interface {
ListConnectors(ctx context.Context, in *apiv1.ListConnectorsRequest, opts ...grpc.CallOption) (*apiv1.ListConnectorsResponse, error)
GetConnector(ctx context.Context, in *apiv1.GetConnectorRequest, opts ...grpc.CallOption) (*apiv1.GetConnectorResponse, error)
ListConnectorPlugins(ctx context.Context, in *apiv1.ListConnectorPluginsRequest, opts ...grpc.CallOption) (*apiv1.ListConnectorPluginsResponse, error)
}

//go:generate mockgen -destination=mock/pipeline_service.go -package=mock . PipelineService

// PipelineService defines the methods of the PipelineServiceClient that are currently used by the CLI.
type PipelineService interface {
ListPipelines(ctx context.Context, in *apiv1.ListPipelinesRequest, opts ...grpc.CallOption) (*apiv1.ListPipelinesResponse, error)
GetPipeline(ctx context.Context, in *apiv1.GetPipelineRequest, opts ...grpc.CallOption) (*apiv1.GetPipelineResponse, error)
GetDLQ(ctx context.Context, in *apiv1.GetDLQRequest, opts ...grpc.CallOption) (*apiv1.GetDLQResponse, error)
}

//go:generate mockgen -destination=mock/processor_service.go -package=mock . ProcessorService

// ProcessorService defines the methods of the ProcessorServiceClient that are currently used by the CLI.
type ProcessorService interface {
ListProcessors(ctx context.Context, in *apiv1.ListProcessorsRequest, opts ...grpc.CallOption) (*apiv1.ListProcessorsResponse, error)
GetProcessor(ctx context.Context, in *apiv1.GetProcessorRequest, opts ...grpc.CallOption) (*apiv1.GetProcessorResponse, error)
ListProcessorPlugins(ctx context.Context, in *apiv1.ListProcessorPluginsRequest, opts ...grpc.CallOption) (*apiv1.ListProcessorPluginsResponse, error)
}
Loading