@@ -13,27 +13,32 @@ import (
13
13
"sigs.k8s.io/e2e-framework/pkg/envconf"
14
14
"sigs.k8s.io/e2e-framework/pkg/features"
15
15
16
+ agent "github.com/gitpod-io/gitpod/test/pkg/agent/workspace/api"
16
17
"github.com/gitpod-io/gitpod/test/pkg/integration"
17
18
)
18
19
19
- type GitHooksTest struct {
20
+ const (
21
+ FILE_CREATED_HOOKS = "output.txt"
22
+ )
23
+
24
+ type GitHooksTestCase struct {
20
25
Name string
21
26
ContextURL string
22
27
WorkspaceRoot string
23
28
}
24
29
25
- func GithuHooksTest (t * testing.T ) {
30
+ func TestGitHooks (t * testing.T ) {
26
31
userToken , _ := os .LookupEnv ("USER_TOKEN" )
27
32
integration .SkipWithoutUsername (t , username )
28
33
integration .SkipWithoutUserToken (t , userToken )
29
34
30
35
parallelLimiter := make (chan struct {}, 2 )
31
36
32
- tests := []GitHooksTest {
37
+ tests := []GitHooksTestCase {
33
38
{
34
39
Name : "husky" ,
35
40
ContextURL : "https://github.com/gitpod-io/gitpod-test-repo/tree/husky" ,
36
- WorkspaceRoot : "/workspace/template-golang-cli " ,
41
+ WorkspaceRoot : "/workspace/gitpod-test-repo " ,
37
42
},
38
43
}
39
44
@@ -90,7 +95,7 @@ func GithuHooksTest(t *testing.T) {
90
95
api := integration .NewComponentAPI (ctx , cfg .Namespace (), kubeconfig , cfg .Client ())
91
96
defer api .Done (t )
92
97
93
- _ , stopWs , err := integration .LaunchWorkspaceFromContextURL (t , ctx , test .ContextURL , username , api )
98
+ wsInfo , stopWs , err := integration .LaunchWorkspaceFromContextURL (t , ctx , test .ContextURL , username , api )
94
99
if err != nil {
95
100
t .Fatal (err )
96
101
}
@@ -106,6 +111,25 @@ func GithuHooksTest(t *testing.T) {
106
111
t .Fatal (err )
107
112
}
108
113
}()
114
+ rsa , closer , err := integration .Instrument (integration .ComponentWorkspace , "workspace" , cfg .Namespace (), kubeconfig , cfg .Client (), integration .WithInstanceID (wsInfo .LatestInstance .ID ))
115
+ if err != nil {
116
+ t .Fatal (err )
117
+ }
118
+ defer rsa .Close ()
119
+ integration .DeferCloser (t , closer )
120
+
121
+ var ls agent.ListDirResponse
122
+ err = rsa .Call ("WorkspaceAgent.ListDir" , & agent.ListDirRequest {
123
+ Dir : test .WorkspaceRoot ,
124
+ }, & ls )
125
+ if err != nil {
126
+ t .Fatal (err )
127
+ }
128
+ for _ , f := range ls .Files {
129
+ if f == FILE_CREATED_HOOKS {
130
+ t .Fatal ("Checkout hooks are executed" )
131
+ }
132
+ }
109
133
})
110
134
}
111
135
}
0 commit comments