File tree Expand file tree Collapse file tree 2 files changed +74
-0
lines changed
components/public-api-server/pkg/apiv1 Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 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 apiv1
6+
7+ import (
8+ "context"
9+ v1 "github.com/gitpod-io/gitpod/public-api/v1"
10+ )
11+
12+ func NewPrebuildService () * PrebuildService {
13+ return & PrebuildService {
14+ UnimplementedPrebuildsServiceServer : & v1.UnimplementedPrebuildsServiceServer {},
15+ }
16+ }
17+
18+ type PrebuildService struct {
19+ * v1.UnimplementedPrebuildsServiceServer
20+ }
21+
22+ func (p * PrebuildService ) GetPrebuild (ctx context.Context , req * v1.GetPrebuildRequest ) (* v1.GetPrebuildResponse , error ) {
23+ return & v1.GetPrebuildResponse {
24+ ResponseStatus : nil ,
25+ Prebuild : & v1.Prebuild {
26+ PrebuildId : req .GetPrebuildId (),
27+ Spec : & v1.PrebuildSpec {
28+ Context : & v1.WorkspaceContext {
29+ ContextUrl : "https://github.com/gitpod-io/gitpod" ,
30+ Details : nil ,
31+ },
32+ Incremental : true ,
33+ },
34+ Status : nil ,
35+ },
36+ }, nil
37+ }
Original file line number Diff line number Diff line change 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 apiv1
6+
7+ import (
8+ "context"
9+ v1 "github.com/gitpod-io/gitpod/public-api/v1"
10+ "github.com/stretchr/testify/require"
11+ "testing"
12+ )
13+
14+ func TestPrebuildService_GetPrebuild (t * testing.T ) {
15+ svc := NewPrebuildService ()
16+
17+ prebuildID := "some-prebuild-id"
18+ resp , err := svc .GetPrebuild (context .Background (), & v1.GetPrebuildRequest {
19+ PrebuildId : prebuildID ,
20+ })
21+ require .NoError (t , err )
22+ require .Equal (t , & v1.GetPrebuildResponse {
23+ ResponseStatus : nil ,
24+ Prebuild : & v1.Prebuild {
25+ PrebuildId : prebuildID ,
26+ Spec : & v1.PrebuildSpec {
27+ Context : & v1.WorkspaceContext {
28+ ContextUrl : "https://github.com/gitpod-io/gitpod" ,
29+ Details : nil ,
30+ },
31+ Incremental : true ,
32+ },
33+ Status : nil ,
34+ },
35+ }, resp )
36+
37+ }
You can’t perform that action at this time.
0 commit comments