@@ -10,20 +10,24 @@ import (
1010 "github.com/gitpod-io/gitpod/common-go/baseserver"
1111 gitpod "github.com/gitpod-io/gitpod/gitpod-protocol"
1212 v1 "github.com/gitpod-io/gitpod/public-api/v1"
13+ "github.com/google/go-cmp/cmp"
1314 "github.com/stretchr/testify/require"
1415 "google.golang.org/grpc"
1516 "google.golang.org/grpc/codes"
1617 "google.golang.org/grpc/credentials/insecure"
1718 "google.golang.org/grpc/metadata"
1819 "google.golang.org/grpc/status"
19- "google.golang.org/protobuf/proto "
20+ "google.golang.org/protobuf/testing/protocmp "
2021 "testing"
2122)
2223
2324func TestWorkspaceService_GetWorkspace (t * testing.T ) {
2425 const (
2526 bearerToken = "bearer-token-for-tests"
2627 foundWorkspaceID = "easycz-seer-xl8o1zacpyw"
28+ contextURL = "https://github.com/gitpod/pull/1111"
29+ ownerID = "c6zz4631-3bbc-4hj4-be80-3dd05c66ee4e"
30+ description = "This is the description"
2731 )
2832
2933 srv := baseserver .NewForTests (t )
@@ -32,7 +36,26 @@ func TestWorkspaceService_GetWorkspace(t *testing.T) {
3236 api : & FakeGitpodAPI {workspaces : map [string ]* gitpod.WorkspaceInfo {
3337 foundWorkspaceID : {
3438 LatestInstance : & gitpod.WorkspaceInstance {},
35- Workspace : & gitpod.Workspace {},
39+ Workspace : & gitpod.Workspace {
40+ BaseImageNameResolved : "" ,
41+ BasedOnPrebuildID : "" ,
42+ BasedOnSnapshotID : "" ,
43+ Config : nil ,
44+ ContentDeletedTime : "" ,
45+ Context : nil ,
46+ ContextURL : contextURL ,
47+ CreationTime : "" ,
48+ Deleted : false ,
49+ Description : description ,
50+ ID : foundWorkspaceID ,
51+ ImageNameResolved : "" ,
52+ ImageSource : nil ,
53+ OwnerID : ownerID ,
54+ Pinned : false ,
55+ Shareable : false ,
56+ SoftDeleted : "" ,
57+ Type : "" ,
58+ },
3659 },
3760 }},
3861 }
@@ -60,13 +83,16 @@ func TestWorkspaceService_GetWorkspace(t *testing.T) {
6083 Response : & v1.GetWorkspaceResponse {
6184 Result : & v1.Workspace {
6285 WorkspaceId : foundWorkspaceID ,
63- OwnerId : "mock_owner" ,
64- ProjectId : "mock_project_id " ,
86+ OwnerId : ownerID ,
87+ ProjectId : "" ,
6588 Context : & v1.WorkspaceContext {
66- ContextUrl : "https://github.com/gitpod-io/gitpod" ,
67- Details : nil ,
89+ ContextUrl : contextURL ,
90+ Details : & v1.WorkspaceContext_Git_ {Git : & v1.WorkspaceContext_Git {
91+ NormalizedContextUrl : contextURL ,
92+ Commit : "" ,
93+ }},
6894 },
69- Description : "This is a mock response" ,
95+ Description : description ,
7096 },
7197 },
7298 },
@@ -84,7 +110,9 @@ func TestWorkspaceService_GetWorkspace(t *testing.T) {
84110 WorkspaceId : scenario .WorkspaceID ,
85111 })
86112 require .Equal (t , scenario .ErrorCode , status .Code (err ), "status code must match" )
87- require .True (t , proto .Equal (scenario .Response , resp ))
113+ if diff := cmp .Diff (scenario .Response , resp , protocmp .Transform ()); diff != "" {
114+ t .Errorf ("unexpected difference:\n %v" , diff )
115+ }
88116 })
89117
90118 }
0 commit comments