Skip to content

Commit 369b325

Browse files
committed
Final Commit for PR Merge
1 parent 83832c9 commit 369b325

10 files changed

+10
-136
lines changed

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c
1010
github.com/project-codeflare/multi-cluster-app-dispatcher v1.37.0
1111
github.com/ray-project/kuberay/ray-operator v0.0.0-20231016183545-097828931d15
12+
github.com/stretchr/testify v1.8.4
1213
k8s.io/api v0.26.3
1314
k8s.io/apimachinery v0.26.3
1415
k8s.io/client-go v0.26.3
@@ -47,12 +48,13 @@ require (
4748
github.com/modern-go/reflect2 v1.0.2 // indirect
4849
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
4950
github.com/pkg/errors v0.9.1 // indirect
51+
github.com/pmezard/go-difflib v1.0.0 // indirect
5052
github.com/prometheus/client_golang v1.14.0 // indirect
5153
github.com/prometheus/client_model v0.3.0 // indirect
5254
github.com/prometheus/common v0.37.0 // indirect
5355
github.com/prometheus/procfs v0.8.0 // indirect
5456
github.com/spf13/pflag v1.0.5 // indirect
55-
github.com/stretchr/testify v1.8.4 // indirect
57+
github.com/stretchr/objx v0.5.0 // indirect
5658
golang.org/x/net v0.12.0 // indirect
5759
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
5860
golang.org/x/sys v0.10.0 // indirect

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
381381
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
382382
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
383383
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
384+
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
384385
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
385386
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
386387
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=

support/batch_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
func TestGetJob(t *testing.T) {
3030

3131
g := gomega.NewGomegaWithT(t)
32-
// Create a fake client that returns different Job objects.
32+
3333
fakeJobs := []runtime.Object{
3434
&batchv1.Job{
3535
ObjectMeta: metav1.ObjectMeta{
@@ -49,7 +49,6 @@ func TestGetJob(t *testing.T) {
4949
jobFunc := Job(test, "my-namespace", "my-job-1")
5050
job := jobFunc(g)
5151

52-
// Assertions
5352
g.Expect(job.Name).To(gomega.Equal("my-job-1"))
5453
g.Expect(job.Namespace).To(gomega.Equal("my-namespace"))
5554

support/environment_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func TestGetClusterType(t *testing.T) {
123123
for _, tt := range tests {
124124
t.Run(tt.name, func(t *testing.T) {
125125
os.Setenv(ClusterTypeEnvVar, tt.envVarValue)
126-
actual := GetClusterType(ttt) // Pass tt as an argument to GetClusterType
126+
actual := GetClusterType(ttt)
127127
if actual != tt.expected {
128128
gomega.Expect(actual).To(
129129
gomega.Equal(tt.expected),

support/image_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ func TestGetImageStream(t *testing.T) {
3333

3434
err := fakeClient.Get(context.TODO(), client.ObjectKey{Name: "my-imagestream-1", Namespace: "my-namespace"}, image)
3535
g.Expect(err).ToNot(gomega.HaveOccurred())
36-
// Assertions
3736
g.Expect(image.Name).To(gomega.Equal("my-imagestream-1"))
3837
g.Expect(image.Namespace).To(gomega.Equal("my-namespace"))
3938
}

support/ingress_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
func TestGetIngress(t *testing.T) {
1414

1515
g := gomega.NewGomegaWithT(t)
16-
// Create a fake client that returns different Ingress objects.
16+
// Create a fake client that returns Ingress objects.
1717
fakeIngress := []runtime.Object{
1818
&networkingv1.Ingress{
1919
ObjectMeta: metav1.ObjectMeta{
@@ -33,9 +33,6 @@ func TestGetIngress(t *testing.T) {
3333
ingressFunc := Ingress(test, "my-namespace", "my-ingress-1")
3434
ingress := ingressFunc(g)
3535

36-
//fmt.Printf("Retrieved ingress object: %+v\n", ingress)
37-
38-
// Assertions
3936
g.Expect(ingress.Name).To(gomega.Equal("my-ingress-1"))
4037
g.Expect(ingress.Namespace).To(gomega.Equal("my-namespace"))
4138
}

support/machine_test.go

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -38,124 +38,3 @@ func TestGetMachineSets(t *testing.T) {
3838
g.Expect(machine.Namespace).To(gomega.Equal("openshift-machine-api"))
3939

4040
}
41-
42-
/*
43-
import (
44-
45-
"testing"
46-
47-
"github.com/onsi/gomega"
48-
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
49-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
50-
"k8s.io/apimachinery/pkg/runtime"
51-
"k8s.io/client-go/kubernetes/fake"
52-
53-
"sigs.k8s.io/controller-runtime/pkg/client"
54-
55-
"k8s.io/client-go/kubernetes"
56-
57-
)
58-
59-
func TestGetMachines(t *testing.T) {
60-
g := gomega.NewWithT(t)
61-
62-
// Create a fake client with test data
63-
scheme := runtime.NewScheme()
64-
_ = machinev1beta1.AddToScheme(scheme)
65-
testmachines := []client.Object{
66-
&machinev1beta1.Machine{
67-
ObjectMeta: metav1.ObjectMeta{
68-
Name: "machine-1",
69-
Namespace: "default",
70-
},
71-
// ...
72-
},
73-
&machinev1beta1.Machine{
74-
ObjectMeta: metav1.ObjectMeta{
75-
Name: "machine-2",
76-
Namespace: "default",
77-
},
78-
// ...
79-
},
80-
}
81-
fakeClient := fake.NewSimpleClientset(testmachines...)
82-
83-
// Define the machine set name to use in the test
84-
machineSetName := "my-machine-set"
85-
86-
// Create a fake test object with the fake client
87-
test := fakeTest{t, fakeClient}
88-
89-
// Call the GetMachines function and assert the result
90-
result := GetMachines(test, machineSetName)
91-
g.Expect(result).To(gomega.HaveLen(2))
92-
g.Expect(result[0].Name).To(gomega.Equal("machine-1"))
93-
g.Expect(result[1].Name).To(gomega.Equal("machine-2"))
94-
}
95-
96-
// Define a fake test object that implements the Test interface
97-
type fakeTest struct {
98-
*testing.T
99-
client kubernetes.Interface
100-
}
101-
102-
// Implement the Test interface for the fakeTest object
103-
func (f fakeTest) Client() kubernetes.Interface {
104-
return f.client
105-
}
106-
*/
107-
/*
108-
109-
func TestGetMachines(t *testing.T) {
110-
g := gomega.NewWithT(t)
111-
112-
scheme := runtime.NewScheme()
113-
_ = machinev1beta1.AddToScheme(scheme)
114-
// Create a fake client and add some test data
115-
testmachines := []client.Object{
116-
&machinev1beta1.Machine{
117-
ObjectMeta: metav1.ObjectMeta{
118-
Name: "machine-1",
119-
Namespace: "default",
120-
},
121-
// ...
122-
},
123-
&machinev1beta1.Machine{
124-
ObjectMeta: metav1.ObjectMeta{
125-
Name: "machine-2",
126-
Namespace: "default",
127-
},
128-
// ...
129-
},
130-
}
131-
_ = NewFakeKubeClientWithMachines(scheme, testmachines...)
132-
// Define the machine set name to use in the test
133-
machineSetName := "my-machine-set"
134-
135-
test := With(t).(*T)
136-
137-
138-
139-
// Call the GetMachines function and assert the result
140-
result := GetMachines(test, machineSetName)
141-
g.Expect(result).To(gomega.HaveLen(3))
142-
g.Expect(result[0].Name).To(gomega.Equal("machine-1"))
143-
g.Expect(result[1].Name).To(gomega.Equal("machine-2"))
144-
}
145-
146-
*/
147-
/*
148-
import (
149-
"testing"
150-
"github.com/stretchr/testify/assert"
151-
)
152-
func TestGetMachines(t *testing.T) {
153-
t.Run("GetMachines returns machines for a given machine set", func(t *testing.T) {
154-
machineSetName := "test-machine-set"
155-
test := With(t).(*T)
156-
machines := GetMachines(test, machineSetName)
157-
assert.Len(t, machines, 1)
158-
assert.Equal(t, machines[0].Name, "test-machine")
159-
})
160-
}
161-
*/

support/ocm_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package support
22

3+
// Need to MOck OCM COnnection
4+
35
/*
46
import (
57
"testing"
@@ -13,7 +15,7 @@ import (
1315
func TestGetMachinePools(t *testing.T) {
1416
// Create a fake OpenShift client for testing
1517
fakeClient := fake.NewSimpleClientset(machinePool{
16-
MachinePool: &cmv1.MachinePool{
18+
&cmv1.MachinePool{
1719
ObjectMeta: metav1.ObjectMeta{
1820
Name: "test-machinepool",
1921
Namespace: "test-namespace",

support/ray_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ func TestGetRayJob(t *testing.T) {
3333
err := fakeClient.Get(context.TODO(), client.ObjectKey{Name: "my-job-1", Namespace: "my-namespace"}, rayJob)
3434
g.Expect(err).ToNot(gomega.HaveOccurred())
3535

36-
//fmt.Printf("Retrieved job object: %+v\n", rayJob)
37-
3836
g.Expect(rayJob.Name).To(gomega.Equal("my-job-1"))
3937
g.Expect(rayJob.Namespace).To(gomega.Equal("my-namespace"))
4038
}
@@ -60,8 +58,6 @@ func TestGetRayCluster(t *testing.T) {
6058
err := fakeClient.Get(context.TODO(), client.ObjectKey{Name: "my-cluster-1", Namespace: "my-namespace"}, raycluster)
6159
g.Expect(err).ToNot(gomega.HaveOccurred())
6260

63-
//fmt.Printf("Retrieved job object: %+v\n", rayJob)
64-
6561
g.Expect(raycluster.Name).To(gomega.Equal("my-cluster-1"))
6662
g.Expect(raycluster.Namespace).To(gomega.Equal("my-namespace"))
6763
}

support/route_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func TestGetRoute(t *testing.T) {
3434
err := fakeClient.Get(context.TODO(), client.ObjectKey{Name: "test-1", Namespace: "my-namespace"}, route)
3535
g.Expect(err).ToNot(gomega.HaveOccurred())
3636

37-
// Assertions
3837
g.Expect(route.Name).To(gomega.Equal("test-1"))
3938
g.Expect(route.Namespace).To(gomega.Equal("my-namespace"))
4039

0 commit comments

Comments
 (0)