Skip to content

Commit

Permalink
[tests] show dotfile installing failure reason (#20397)
Browse files Browse the repository at this point in the history
* [tests] show dotfile installing failure reason

* Fix dotfile tests

* Add docs

---------

Co-authored-by: Filip Troníček <[email protected]>
  • Loading branch information
mustard-mh and filiptronicek authored Nov 29, 2024
1 parent 050942f commit 0aabebc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/tests/components/ws-manager/dotfiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ func TestDotfiles(t *testing.T) {
t.Fatal(err)
}

// Scopes should larger than https://github.com/gitpod-io/gitpod/blob/main/components/supervisor/pkg/serverapi/publicapi.go#L99-L109
tokenId, err := api.CreateOAuth2Token(username, []string{
"function:getToken",
"function:openPort",
"function:getOpenPorts",
"function:guessGitTokenScopes",
"function:getWorkspace",
"function:sendHeartBeat",
"function:trackEvent",
"resource:token::*::get",
})
Expand All @@ -70,8 +72,8 @@ func TestDotfiles(t *testing.T) {
"token": "%v",
"kind": "gitpod",
"host": "%v",
"scope": ["function:getToken", "function:openPort", "function:getOpenPorts", "function:guessGitTokenScopes", "function:getWorkspace", "function:trackEvent", "resource:token::*::get"],
"expiryDate": "2022-10-26T10:38:05.232Z",
"scope": ["function:getToken", "function:openPort", "function:sendHeartBeat", "function:getOpenPorts", "function:guessGitTokenScopes", "function:getWorkspace", "function:trackEvent", "resource:token::*::get"],
"expiryDate": "2026-10-26T10:38:05.232Z",
"reuse": 4
}]`, tokenId, getHostUrl(ctx, t, cfg.Client(), cfg.Namespace())),
},
Expand Down Expand Up @@ -174,6 +176,15 @@ func assertDotfiles(t *testing.T, rsa *integration.RpcClient) error {
}

if len(dotfiles) > 0 {
var cat agent.ExecResponse
err := rsa.Call("WorkspaceAgent.Exec", &agent.ExecRequest{
Dir: "/",
Command: "cat",
Args: []string{"/home/gitpod/.dotfiles.log"},
}, &cat)
if err == nil {
t.Fatalf("dotfiles were not installed successfully: %+v, .dotfiles.log: %s", dotfiles, cat.Stdout)
}
t.Fatalf("dotfiles were not installed successfully: %+v", dotfiles)
}

Expand Down

0 comments on commit 0aabebc

Please sign in to comment.