File tree 2 files changed +27
-4
lines changed
workspaces/controller/internal
2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ func NewExampleWorkspaceKind1(name string) *kubefloworgv1beta1.WorkspaceKind {
218
218
HTTPProxy : & kubefloworgv1beta1.HTTPProxy {
219
219
RemovePathPrefix : ptr .To (false ),
220
220
RequestHeaders : & kubefloworgv1beta1.IstioHeaderOperations {
221
- Set : map [string ]string {"X-RStudio-Root-Path" : "{{ httpPathPrefix 'rstudio ' }}" },
221
+ Set : map [string ]string {"X-RStudio-Root-Path" : "{{ httpPathPrefix '.PathPrefix ' }}" },
222
222
Add : map [string ]string {},
223
223
Remove : []string {},
224
224
},
Original file line number Diff line number Diff line change 1
1
package helper
2
2
3
- import "github.com/onsi/ginkgo/v2"
3
+ import (
4
+ kubefloworgv1beta1 "github.com/kubeflow/notebooks/workspaces/controller/api/v1beta1"
5
+ "github.com/onsi/ginkgo/v2"
6
+ "github.com/onsi/gomega"
7
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8
+ )
4
9
5
10
var _ = ginkgo .Describe ("helper" , func () {
6
11
7
12
ginkgo .It ("should render request headers correctly" , func () {
8
13
9
- m := make (map [string ]string , 1 )
10
- m ["X-RStudio" ] = "{{ httpPathPrefix 'rstudio' }}"
14
+ containerPortsIdMap := make (map [string ]kubefloworgv1beta1.ImagePort )
15
+ containerPortsIdMap ["rstudio" ] = kubefloworgv1beta1.ImagePort {
16
+ Port : 8080 ,
17
+ Id : "rstudio" ,
18
+ }
19
+
20
+ headers := map [string ]string {"X-RStudio-Root-Path" : `{{ httpPathPrefix "rstudio" }}` }
21
+
22
+ ws := & kubefloworgv1beta1.Workspace {
23
+ ObjectMeta : metav1.ObjectMeta {
24
+ Name : "simple" ,
25
+ Namespace : "default" ,
26
+ },
27
+ }
28
+
29
+ function := GenerateHttpPathPrefixFunc (ws , containerPortsIdMap )
30
+
31
+ out := RenderHeadersWithHttpPathPrefix (headers , function )
32
+
33
+ gomega .Expect (out ["X-RStudio-Root-Path" ]).To (gomega .Equal ("/workspace/default/simple/rstudio/" ))
11
34
})
12
35
})
You can’t perform that action at this time.
0 commit comments