Skip to content

Commit 264a1de

Browse files
committed
[ide-service] add test cases for ide config parse
1 parent 703d429 commit 264a1de

11 files changed

+632
-0
lines changed

components/ide-service/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ require (
2121
github.com/cespare/xxhash/v2 v2.1.2 // indirect
2222
github.com/davecgh/go-spew v1.1.1 // indirect
2323
github.com/fsnotify/fsnotify v1.4.9 // indirect
24+
github.com/go-test/deep v1.0.5 // indirect
2425
github.com/golang/protobuf v1.5.2 // indirect
2526
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
2627
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect

components/ide-service/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8
284284
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
285285
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
286286
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
287+
github.com/go-test/deep v1.0.5 h1:AKODKU3pDH1RzZzm6YZu77YWtEAq6uh1rLIAQlay2qc=
288+
github.com/go-test/deep v1.0.5/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
287289
github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
288290
github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
289291
github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 server
6+
7+
import (
8+
"context"
9+
"encoding/json"
10+
"testing"
11+
12+
ctesting "github.com/gitpod-io/gitpod/common-go/testing"
13+
)
14+
15+
var (
16+
team = "awesome"
17+
project = "gitpod"
18+
)
19+
20+
func TestCreateDefiniteWorkspacePod(t *testing.T) {
21+
22+
type fixture struct {
23+
IDEConfig
24+
}
25+
type gold struct {
26+
Config IDEConfig
27+
Err string
28+
}
29+
30+
test := ctesting.FixtureTest{
31+
T: t,
32+
Path: "testdata/ideconfig_*.json",
33+
Test: func(t *testing.T, input interface{}) interface{} {
34+
fixture := input.(*fixture)
35+
36+
b, err := json.Marshal(fixture.IDEConfig)
37+
if err != nil {
38+
return &gold{Err: err.Error()}
39+
}
40+
41+
config, err := ParseConfig(context.Background(), b)
42+
if err != nil {
43+
return &gold{Err: err.Error()}
44+
}
45+
return &gold{Config: *config, Err: ""}
46+
},
47+
Fixture: func() interface{} { return &fixture{} },
48+
Gold: func() interface{} { return &gold{} },
49+
}
50+
test.Run()
51+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"Config": {
3+
"supervisorImage": "eu.gcr.io/gitpod-core-dev/build/supervisor:commit-ff38b98b7dde4929159bcaeec68d178898dc2139",
4+
"ideOptions": {
5+
"options": {
6+
"code": {
7+
"orderKey": "00",
8+
"title": "VS Code",
9+
"type": "browser",
10+
"logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg",
11+
"label": "Browser",
12+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9",
13+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9@sha256:9f8f3951386b5490e798308c84695fbf448721ef1febd1779ecd668c47fa601a"
14+
},
15+
"code-desktop": {
16+
"orderKey": "02",
17+
"title": "VS Code",
18+
"type": "desktop",
19+
"logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg",
20+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop:commit-c2b7421628ed5a5fb618817a4fd1549684659c2d",
21+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop-insiders:commit-c2b7421628ed5a5fb618817a4fd1549684659c2d@sha256:d9e39323a5b517ad753a3daeccb7b8d66ed8727bc222fc63cc124f1563723639"
22+
},
23+
"goland": {
24+
"orderKey": "05",
25+
"title": "GoLand",
26+
"type": "desktop",
27+
"logo": "https://ide.gitpod.io/image/ide-logo/golandLogo.svg",
28+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/goland:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df",
29+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/goland:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:665b0456e38cf75e7ca7f300b5fd73827065210df310c6b57d1b41f179af0c46"
30+
},
31+
"intellij": {
32+
"orderKey": "04",
33+
"title": "IntelliJ IDEA",
34+
"type": "desktop",
35+
"logo": "https://ide.gitpod.io/image/ide-logo/intellijIdeaLogo.svg",
36+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df",
37+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:d7528b797a73835ebf51d976c0e73782f501acf08801ca3ad81bde72bc32df98"
38+
},
39+
"phpstorm": {
40+
"orderKey": "07",
41+
"title": "PhpStorm",
42+
"type": "desktop",
43+
"logo": "https://ide.gitpod.io/image/ide-logo/phpstormLogo.svg",
44+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df",
45+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:5c6ef331fbf7379c970565d9d62b9ddfdfbc945c3acaa895020a551144ba42b4"
46+
},
47+
"pycharm": {
48+
"orderKey": "06",
49+
"title": "PyCharm",
50+
"type": "desktop",
51+
"logo": "https://ide.gitpod.io/image/ide-logo/pycharmLogo.svg",
52+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df",
53+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:94e3e684420179fc7ea6bf4245c2c9de666babc4c1366e08cc56b744f27dd275"
54+
}
55+
},
56+
"defaultIde": "code",
57+
"defaultDesktopIde": "code-desktop",
58+
"clients": {
59+
"jetbrains-gateway": {
60+
"defaultDesktopIDE": "intellij",
61+
"desktopIDEs": [
62+
"intellij",
63+
"goland",
64+
"pycharm",
65+
"phpstorm"
66+
],
67+
"installationSteps": [
68+
"If you don't see an open dialog in your browser, make sure you have the \u003ca target='_blank' class='gp-link' href='https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway#getting-started-jetbrains-gateway'\u003eJetBrains Gateway with Gitpod Plugin\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below."
69+
]
70+
},
71+
"vscode": {
72+
"defaultDesktopIDE": "code-desktop",
73+
"desktopIDEs": [
74+
"code-desktop"
75+
],
76+
"installationSteps": [
77+
"If you don't see an open dialog in your browser, make sure you have \u003ca target='_blank' class='gp-link' href='https://code.visualstudio.com/download'\u003eVS Code\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below."
78+
]
79+
},
80+
"vscode-insiders": {
81+
"defaultDesktopIDE": "code-desktop",
82+
"desktopIDEs": [
83+
"code-desktop"
84+
],
85+
"installationSteps": [
86+
"If you don't see an open dialog in your browser, make sure you have \u003ca target='_blank' class='gp-link' href='https://code.visualstudio.com/insiders'\u003eVS Code Insiders\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below."
87+
]
88+
}
89+
}
90+
}
91+
},
92+
"Err": ""
93+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"supervisorImage": "eu.gcr.io/gitpod-core-dev/build/supervisor:commit-ff38b98b7dde4929159bcaeec68d178898dc2139",
3+
"ideOptions": {
4+
"options": {
5+
"code": {
6+
"orderKey": "00",
7+
"title": "VS Code",
8+
"type": "browser",
9+
"logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg",
10+
"label": "Browser",
11+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9",
12+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9"
13+
},
14+
"code-desktop": {
15+
"orderKey": "02",
16+
"title": "VS Code",
17+
"type": "desktop",
18+
"logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg",
19+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop:commit-c2b7421628ed5a5fb618817a4fd1549684659c2d",
20+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop-insiders:commit-c2b7421628ed5a5fb618817a4fd1549684659c2d"
21+
},
22+
"goland": {
23+
"orderKey": "05",
24+
"title": "GoLand",
25+
"type": "desktop",
26+
"logo": "https://ide.gitpod.io/image/ide-logo/golandLogo.svg",
27+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/goland:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df",
28+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/goland:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df"
29+
},
30+
"intellij": {
31+
"orderKey": "04",
32+
"title": "IntelliJ IDEA",
33+
"type": "desktop",
34+
"logo": "https://ide.gitpod.io/image/ide-logo/intellijIdeaLogo.svg",
35+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df",
36+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df"
37+
},
38+
"phpstorm": {
39+
"orderKey": "07",
40+
"title": "PhpStorm",
41+
"type": "desktop",
42+
"logo": "https://ide.gitpod.io/image/ide-logo/phpstormLogo.svg",
43+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df",
44+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df"
45+
},
46+
"pycharm": {
47+
"orderKey": "06",
48+
"title": "PyCharm",
49+
"type": "desktop",
50+
"logo": "https://ide.gitpod.io/image/ide-logo/pycharmLogo.svg",
51+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df",
52+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df"
53+
}
54+
},
55+
"defaultIde": "code",
56+
"defaultDesktopIde": "code-desktop",
57+
"clients": {
58+
"jetbrains-gateway": {
59+
"defaultDesktopIDE": "intellij",
60+
"desktopIDEs": [
61+
"intellij",
62+
"goland",
63+
"pycharm",
64+
"phpstorm"
65+
],
66+
"installationSteps": [
67+
"If you don't see an open dialog in your browser, make sure you have the \u003ca target='_blank' class='gp-link' href='https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway#getting-started-jetbrains-gateway'\u003eJetBrains Gateway with Gitpod Plugin\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below."
68+
]
69+
},
70+
"vscode": {
71+
"defaultDesktopIDE": "code-desktop",
72+
"desktopIDEs": [
73+
"code-desktop"
74+
],
75+
"installationSteps": [
76+
"If you don't see an open dialog in your browser, make sure you have \u003ca target='_blank' class='gp-link' href='https://code.visualstudio.com/download'\u003eVS Code\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below."
77+
]
78+
},
79+
"vscode-insiders": {
80+
"defaultDesktopIDE": "code-desktop",
81+
"desktopIDEs": [
82+
"code-desktop"
83+
],
84+
"installationSteps": [
85+
"If you don't see an open dialog in your browser, make sure you have \u003ca target='_blank' class='gp-link' href='https://code.visualstudio.com/insiders'\u003eVS Code Insiders\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below."
86+
]
87+
}
88+
}
89+
}
90+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"Config": {
3+
"supervisorImage": "eu.gcr.io/gitpod-core-dev/build/supervisor:commit-ff38b98b7dde4929159bcaeec68d178898dc2139",
4+
"ideOptions": {
5+
"options": {
6+
"code": {
7+
"orderKey": "00",
8+
"title": "VS Code",
9+
"type": "browser",
10+
"logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg",
11+
"label": "Browser",
12+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9@sha256:9f8f3951386b5490e798308c84695fbf448721ef1febd1779ecd668c47fa601a",
13+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code:commit-d6329814c2aa34c414574fd0d1301447d6fe82c9@sha256:9f8f3951386b5490e798308c84695fbf448721ef1febd1779ecd668c47fa601a",
14+
"resolveImageDigest": true
15+
},
16+
"code-desktop": {
17+
"orderKey": "02",
18+
"title": "VS Code",
19+
"type": "desktop",
20+
"logo": "https://ide.gitpod.io/image/ide-logo/vscode.svg",
21+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop:commit-c2b7421628ed5a5fb618817a4fd1549684659c2d",
22+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/code-desktop-insiders:commit-c2b7421628ed5a5fb618817a4fd1549684659c2d@sha256:d9e39323a5b517ad753a3daeccb7b8d66ed8727bc222fc63cc124f1563723639"
23+
},
24+
"goland": {
25+
"orderKey": "05",
26+
"title": "GoLand",
27+
"type": "desktop",
28+
"logo": "https://ide.gitpod.io/image/ide-logo/golandLogo.svg",
29+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/goland:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:665b0456e38cf75e7ca7f300b5fd73827065210df310c6b57d1b41f179af0c46",
30+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/goland:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:665b0456e38cf75e7ca7f300b5fd73827065210df310c6b57d1b41f179af0c46",
31+
"resolveImageDigest": true
32+
},
33+
"intellij": {
34+
"orderKey": "04",
35+
"title": "IntelliJ IDEA",
36+
"type": "desktop",
37+
"logo": "https://ide.gitpod.io/image/ide-logo/intellijIdeaLogo.svg",
38+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df",
39+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/intellij:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:d7528b797a73835ebf51d976c0e73782f501acf08801ca3ad81bde72bc32df98"
40+
},
41+
"phpstorm": {
42+
"orderKey": "07",
43+
"title": "PhpStorm",
44+
"type": "desktop",
45+
"logo": "https://ide.gitpod.io/image/ide-logo/phpstormLogo.svg",
46+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df",
47+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/phpstorm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:5c6ef331fbf7379c970565d9d62b9ddfdfbc945c3acaa895020a551144ba42b4"
48+
},
49+
"pycharm": {
50+
"orderKey": "06",
51+
"title": "PyCharm",
52+
"type": "desktop",
53+
"logo": "https://ide.gitpod.io/image/ide-logo/pycharmLogo.svg",
54+
"image": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df",
55+
"latestImage": "eu.gcr.io/gitpod-core-dev/build/ide/pycharm:commit-9a6c79a91b2b1f583d5bcb7f9f1ef54ee977e0df@sha256:94e3e684420179fc7ea6bf4245c2c9de666babc4c1366e08cc56b744f27dd275"
56+
}
57+
},
58+
"defaultIde": "code",
59+
"defaultDesktopIde": "code-desktop",
60+
"clients": {
61+
"jetbrains-gateway": {
62+
"defaultDesktopIDE": "intellij",
63+
"desktopIDEs": [
64+
"intellij",
65+
"goland",
66+
"pycharm",
67+
"phpstorm"
68+
],
69+
"installationSteps": [
70+
"If you don't see an open dialog in your browser, make sure you have the \u003ca target='_blank' class='gp-link' href='https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway#getting-started-jetbrains-gateway'\u003eJetBrains Gateway with Gitpod Plugin\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below."
71+
]
72+
},
73+
"vscode": {
74+
"defaultDesktopIDE": "code-desktop",
75+
"desktopIDEs": [
76+
"code-desktop"
77+
],
78+
"installationSteps": [
79+
"If you don't see an open dialog in your browser, make sure you have \u003ca target='_blank' class='gp-link' href='https://code.visualstudio.com/download'\u003eVS Code\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below."
80+
]
81+
},
82+
"vscode-insiders": {
83+
"defaultDesktopIDE": "code-desktop",
84+
"desktopIDEs": [
85+
"code-desktop"
86+
],
87+
"installationSteps": [
88+
"If you don't see an open dialog in your browser, make sure you have \u003ca target='_blank' class='gp-link' href='https://code.visualstudio.com/insiders'\u003eVS Code Insiders\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below."
89+
]
90+
}
91+
}
92+
}
93+
},
94+
"Err": ""
95+
}

0 commit comments

Comments
 (0)