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

allow grpc server code generation stubs #61

Open
aria3ppp opened this issue Nov 23, 2024 · 2 comments
Open

allow grpc server code generation stubs #61

aria3ppp opened this issue Nov 23, 2024 · 2 comments

Comments

@aria3ppp
Copy link

i need to run integration tests on qdrant server but i do not want to go down with testcontainers heavy stuffs
so i just create mock servers and let clients request go through network but hit an especially forged mock server on the other side
for http server it is simple
for grpc i need server stubs too
but the qdrant go client have striped the server parts
so i propose to let the server stubs into the package to be able test the client in isolation to qdrant server

Current Behavior and Steps to Reproduce

at this time i created a script to locate proto files in qdrant go client module on go module cache and then generate the go code from those files
but i need to remove the client stubs bc they cannot co-exists in the same package bc of protobuf namespaces

panic: proto: file "collections.proto" is already registered
                previously from: "github.com/aria3ppp/rag-server/gen/go/qdrantpb"
                currently from:  "github.com/qdrant/go-client/qdrant"
        See https://protobuf.dev/reference/go/faq#namespace-conflict

so i have to remove the client parts and also link the proto messges to qdrant client

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             (unknown)
// source: collections_service.proto

package qdrantpb

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	. "github.com/qdrant/go-client/qdrant"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

// CollectionsServer is the server API for Collections service.
// All implementations must embed UnimplementedCollectionsServer
// for forward compatibility.
type CollectionsServer interface {
	// Get detailed information about specified existing collection
	Get(context.Context, *GetCollectionInfoRequest) (*GetCollectionInfoResponse, error)
	// Get list name of all existing collections
	List(context.Context, *ListCollectionsRequest) (*ListCollectionsResponse, error)
}
@aria3ppp aria3ppp changed the title allow server code generations allow grpc server code generation stubs Nov 23, 2024
@Anush008
Copy link
Member

Hey @aria3ppp. We've been skipping the server stubs generation when releasing new versions. As described here in step 3.
https://github.com/qdrant/go-client/blob/master/CONTRIBUTING.md#preparing-for-a-new-release

We should also be fine with including them. Since it helps with your use case of mock testing, we'll do so in the next release.

@aria3ppp
Copy link
Author

excellent
so i'll keep this issue open until the next version is released
thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants