1
+ // Copyright 2024.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
1
15
package api
2
16
3
17
import (
@@ -9,15 +23,16 @@ import (
9
23
"os"
10
24
11
25
"github.com/julienschmidt/httprouter"
12
- "github.com/kubeflow/notebooks/workspaces/backend/internal/config"
13
- "github.com/kubeflow/notebooks/workspaces/backend/internal/repositories"
14
26
kubefloworgv1beta1 "github.com/kubeflow/notebooks/workspaces/controller/api/v1beta1"
15
27
. "github.com/onsi/ginkgo/v2"
16
28
. "github.com/onsi/gomega"
17
29
corev1 "k8s.io/api/core/v1"
18
30
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19
31
"k8s.io/apimachinery/pkg/types"
20
32
"sigs.k8s.io/controller-runtime/pkg/client"
33
+
34
+ "github.com/kubeflow/notebooks/workspaces/backend/internal/config"
35
+ "github.com/kubeflow/notebooks/workspaces/backend/internal/repositories"
21
36
)
22
37
23
38
var _ = Describe ("Workspace YAML Handler" , Ordered , func () {
@@ -38,7 +53,7 @@ var _ = Describe("Workspace YAML Handler", Ordered, func() {
38
53
logger := slog .New (slog .NewJSONHandler (os .Stdout , nil ))
39
54
repos := repositories .NewRepositories (k8sClient )
40
55
a = & App {
41
- Config : config.EnvConfig {
56
+ Config : & config.EnvConfig {
42
57
Port : 4000 ,
43
58
},
44
59
repositories : repos ,
@@ -90,7 +105,7 @@ var _ = Describe("Workspace YAML Handler", Ordered, func() {
90
105
})
91
106
92
107
It ("should retrieve the workspace YAML successfully" , func () {
93
- req := httptest .NewRequest (http .MethodGet , fmt .Sprintf ("/api/v1/workspaces/%s/%s/details/yaml" , namespaceName , workspaceKey .Name ), nil )
108
+ req := httptest .NewRequest (http .MethodGet , fmt .Sprintf ("/api/v1/workspaces/%s/%s/details/yaml" , namespaceName , workspaceKey .Name ), http . NoBody )
94
109
rr := httptest .NewRecorder ()
95
110
96
111
ps := httprouter.Params {
@@ -110,7 +125,7 @@ var _ = Describe("Workspace YAML Handler", Ordered, func() {
110
125
})
111
126
112
127
It ("should return 404 when workspace doesn't exist" , func () {
113
- req := httptest .NewRequest (http .MethodGet , fmt .Sprintf ("/api/v1/workspaces/%s/non-existent/details/yaml" , namespaceName ), nil )
128
+ req := httptest .NewRequest (http .MethodGet , fmt .Sprintf ("/api/v1/workspaces/%s/non-existent/details/yaml" , namespaceName ), http . NoBody )
114
129
rr := httptest .NewRecorder ()
115
130
116
131
ps := httprouter.Params {
0 commit comments