You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: opensergo_test.go
    path of file: ./repos/kratos/contrib/opensergo
    
    the code of the file until where you have to start completion: package opensergo

import (
	"net"
	"net/http"
	"os"
	"path/filepath"
	"reflect"
	"testing"

	srvContractPb "github.com/opensergo/opensergo-go/proto/service_contract/v1"
	"golang.org/x/net/context"
	"google.golang.org/genproto/googleapis/api/annotations"
	"google.golang.org/grpc"
	"google.golang.org/protobuf/proto"
	"goog
    
func TestOpenSergo(t *testing.T) {
	srv := grpc.NewServer()
	srvContractPb.RegisterMetadataServiceServer(srv, new(testMetadataServiceServer))
	lis, err := net.Listen("tcp", "127.0.0.1:9090")
	if err != nil {
		t.Fatalf("net.Listen error:%s", err)
	}
	go func() {
		err := srv.Serve(lis)
		if err != nil {
			panic(err)
		}
	}()

	app := &testAppInfo{
		name:     "testApp",
		endpoint: []string{"//example.com:9090", "//foo.com:9090"},
	}

	type args struct {
		opts []Option
	}
	tests := []struct {
		name      string
		args      args
		preFunc   func(t *testing.T)
		deferFunc func(t *testing.T)
		wantErr   bool
	}{
		{
			name: "test_with_opts",
			args: args{
				opts: []Option{
					WithEndpoint("127.0.0.1:9090"),
				},
			},
			wantErr: false,
		},
		{
			name: "test_with_env_endpoint",
			args: args{
				opts: []Option{},
			},
			preFunc: func(t *testing.T) {
				err := os.Setenv("OPENSERGO_ENDPOINT", "127.0.0.1:9090")
				if err != nil {
					panic(err)
				}
			},
			wantErr: false,
		},
		{
			name: "test_with_env_config_file",
			args: args{
				opts: []Option{},
			},
			preFunc: func(t *testing.T) {
				err := os.Setenv("OPENSERGO_BOOTSTRAP", `{"endpoint": "127.0.0.1:9090"}`)
				if err != nil {
					panic(err)
				}
			},
			wantErr: false,
		},
		{
			name: "test_with_env_bootstrap",
			args: args{
				opts: []Option{},
			},
			preFunc: func(t *testing.T) {
				fileContent := `{"endpoint": "127.0.0.1:9090"}`
				err := os.WriteFile("test.json", []byte(fileContent), 0o644)
				if err != nil {
					t.Fatalf("os.WriteFile error:%s", err)
				}
				confPath, err := filepath.Abs("./test.json")
				if err != nil {
					t.Fatalf("filepath.Abs error:%s", err)
				}
				err = os.Setenv("OPENSERGO_BOOTSTRAP_CONFIG", confPath)
				if err != nil {
					panic(err)
				}
			},
			deferFunc: func(t *testing.T) {
				path := os.Getenv("OPENSERGO_BOOTSTRAP_CONFIG")
				if path != "" {
					err := os.Remove(path)
					if err != nil {
						t.Fatalf("os.Remove error:%s", err)
					}
				}
			},
			wantErr: false,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if tt.preFunc != nil {
				tt.preFunc(t)
			}
			if tt.deferFunc != nil {
				defer tt.deferFunc(t)
			}
			osServer, err := New(tt.args.opts...)
			if (err != nil) != tt.wantErr {
				t.Errorf("New() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
			err = osServer.ReportMetadata(context.Background(), app)
			if (err != nil) != tt.wantErr {
				t.Errorf("ReportMetadata() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
		})
	}
}