Skip to content

Commit 0aabebc

Browse files
[tests] show dotfile installing failure reason (#20397)
* [tests] show dotfile installing failure reason * Fix dotfile tests * Add docs --------- Co-authored-by: Filip Troníček <[email protected]>
1 parent 050942f commit 0aabebc

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/tests/components/ws-manager/dotfiles_test.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ func TestDotfiles(t *testing.T) {
4545
t.Fatal(err)
4646
}
4747

48+
// Scopes should larger than https://github.com/gitpod-io/gitpod/blob/main/components/supervisor/pkg/serverapi/publicapi.go#L99-L109
4849
tokenId, err := api.CreateOAuth2Token(username, []string{
4950
"function:getToken",
5051
"function:openPort",
5152
"function:getOpenPorts",
5253
"function:guessGitTokenScopes",
5354
"function:getWorkspace",
55+
"function:sendHeartBeat",
5456
"function:trackEvent",
5557
"resource:token::*::get",
5658
})
@@ -70,8 +72,8 @@ func TestDotfiles(t *testing.T) {
7072
"token": "%v",
7173
"kind": "gitpod",
7274
"host": "%v",
73-
"scope": ["function:getToken", "function:openPort", "function:getOpenPorts", "function:guessGitTokenScopes", "function:getWorkspace", "function:trackEvent", "resource:token::*::get"],
74-
"expiryDate": "2022-10-26T10:38:05.232Z",
75+
"scope": ["function:getToken", "function:openPort", "function:sendHeartBeat", "function:getOpenPorts", "function:guessGitTokenScopes", "function:getWorkspace", "function:trackEvent", "resource:token::*::get"],
76+
"expiryDate": "2026-10-26T10:38:05.232Z",
7577
"reuse": 4
7678
}]`, tokenId, getHostUrl(ctx, t, cfg.Client(), cfg.Namespace())),
7779
},
@@ -174,6 +176,15 @@ func assertDotfiles(t *testing.T, rsa *integration.RpcClient) error {
174176
}
175177

176178
if len(dotfiles) > 0 {
179+
var cat agent.ExecResponse
180+
err := rsa.Call("WorkspaceAgent.Exec", &agent.ExecRequest{
181+
Dir: "/",
182+
Command: "cat",
183+
Args: []string{"/home/gitpod/.dotfiles.log"},
184+
}, &cat)
185+
if err == nil {
186+
t.Fatalf("dotfiles were not installed successfully: %+v, .dotfiles.log: %s", dotfiles, cat.Stdout)
187+
}
177188
t.Fatalf("dotfiles were not installed successfully: %+v", dotfiles)
178189
}
179190

0 commit comments

Comments
 (0)