Skip to content

Commit a94ca8e

Browse files
committed
test: cover juicefs runtime2 build scenario
Signed-off-by: Harsh <harshmastic@gmail.com>
1 parent 7822c82 commit a94ca8e

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

pkg/ddc/juicefs/engine_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,35 @@ var _ = Describe("JuiceFS engine", func() {
128128
Expect(engine).To(BeNil())
129129
})
130130
})
131+
132+
When("the context runtime is runtime2 named test but the client is missing that runtime", func() {
133+
It("returns a runtime info error for the old runtime2 build scenario", func() {
134+
runtime2Key := types.NamespacedName{
135+
Name: "test",
136+
Namespace: runtimeNamespace,
137+
}
138+
runtime2 := &datav1alpha1.JuiceFSRuntime{
139+
ObjectMeta: metav1.ObjectMeta{
140+
Name: runtime2Key.Name,
141+
Namespace: runtime2Key.Namespace,
142+
},
143+
}
144+
145+
ctx := cruntime.ReconcileRequestContext{
146+
NamespacedName: runtime2Key,
147+
Client: fake.NewFakeClientWithScheme(testScheme, runtime.DeepCopy()),
148+
Log: fake.NullLogger(),
149+
RuntimeType: "juicefs",
150+
Runtime: runtime2,
151+
}
152+
153+
engine, err := Build("test-id", ctx)
154+
155+
Expect(err).To(HaveOccurred())
156+
Expect(err.Error()).To(ContainSubstring("failed to get runtime info"))
157+
Expect(engine).To(BeNil())
158+
})
159+
})
131160
})
132161

133162
Describe("Precheck", func() {

0 commit comments

Comments
 (0)