Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/ide-service/cmd/test.go
2498 views
1
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package cmd
6
7
import (
8
"context"
9
"fmt"
10
11
"github.com/gitpod-io/gitpod/common-go/log"
12
api "github.com/gitpod-io/gitpod/ide-service-api"
13
"github.com/spf13/cobra"
14
"google.golang.org/grpc"
15
"google.golang.org/grpc/credentials/insecure"
16
)
17
18
func init() {
19
rootCmd.AddCommand(testCommand)
20
}
21
22
var testCommand = &cobra.Command{
23
Use: "test",
24
Short: "Exec GRPC test",
25
Version: Version,
26
Run: func(cmd *cobra.Command, args []string) {
27
cfg := getConfig()
28
conn, err := grpc.Dial(cfg.Server.Services.GRPC.Address, grpc.WithTransportCredentials(insecure.NewCredentials()))
29
if err != nil {
30
log.Fatal(err)
31
}
32
client := api.NewIDEServiceClient(conn)
33
resp, err := client.GetConfig(context.Background(), &api.GetConfigRequest{})
34
if err != nil {
35
log.WithError(err).Error("cannot get config")
36
return
37
}
38
fmt.Println(resp.Content)
39
},
40
}
41
42