Skip to content

Commit efb9333

Browse files
committed
test(alluxio): clarify ginkgo spec intent
Signed-off-by: Harsh <harshmastic@gmail.com>
1 parent 852f118 commit efb9333

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

pkg/ddc/alluxio/engine_transform_file_scope_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func (c erroringGetClient) Get(_ context.Context, _ client.ObjectKey, _ client.O
4747
var _ = Describe("Alluxio engine and transform file scope", Label("pkg.ddc.alluxio.engine_transform_file_scope_test.go"), func() {
4848
Describe("Build", func() {
4949
It("returns an error when runtime is missing", func() {
50+
// Verify Build rejects reconcile requests without a parsed Alluxio runtime.
5051
engine, err := Build("test-id", cruntime.ReconcileRequestContext{
5152
NamespacedName: types.NamespacedName{Name: "demo", Namespace: "fluid"},
5253
Log: fake.NullLogger(),
@@ -58,6 +59,7 @@ var _ = Describe("Alluxio engine and transform file scope", Label("pkg.ddc.allux
5859
})
5960

6061
It("returns an error when runtime has the wrong type", func() {
62+
// Verify Build rejects reconcile requests carrying a non-Alluxio runtime object.
6163
engine, err := Build("test-id", cruntime.ReconcileRequestContext{
6264
NamespacedName: types.NamespacedName{Name: "demo", Namespace: "fluid"},
6365
Log: fake.NullLogger(),
@@ -72,6 +74,7 @@ var _ = Describe("Alluxio engine and transform file scope", Label("pkg.ddc.allux
7274

7375
Describe("Precheck", func() {
7476
It("reports whether the alluxio runtime exists", func() {
77+
// Confirm Precheck returns true when the target AlluxioRuntime is present.
7578
key := types.NamespacedName{Name: "demo", Namespace: "fluid"}
7679
runtime := &datav1alpha1.AlluxioRuntime{ObjectMeta: metav1.ObjectMeta{Name: key.Name, Namespace: key.Namespace}}
7780
client := fake.NewFakeClientWithScheme(datav1alpha1.UnitTestScheme, runtime)
@@ -83,13 +86,15 @@ var _ = Describe("Alluxio engine and transform file scope", Label("pkg.ddc.allux
8386
})
8487

8588
It("returns false without error when the runtime is absent", func() {
89+
// Confirm missing runtimes are treated as a clean not-found result.
8690
found, err := Precheck(fake.NewFakeClientWithScheme(datav1alpha1.UnitTestScheme), types.NamespacedName{Name: "missing", Namespace: "fluid"})
8791

8892
Expect(err).NotTo(HaveOccurred())
8993
Expect(found).To(BeFalse())
9094
})
9195

9296
It("returns the client error for non-not-found failures", func() {
97+
// Confirm unexpected client errors are surfaced instead of coerced into not-found.
9398
failingClient := erroringGetClient{
9499
Client: fake.NewFakeClientWithScheme(datav1alpha1.UnitTestScheme),
95100
err: apierrors.NewForbidden(schema.GroupResource{Group: datav1alpha1.GroupVersion.Group, Resource: "alluxioruntimes"}, "demo", nil),
@@ -105,6 +110,7 @@ var _ = Describe("Alluxio engine and transform file scope", Label("pkg.ddc.allux
105110

106111
Describe("transformPlacementMode", func() {
107112
It("defaults to exclusive placement when the dataset placement mode is empty", func() {
113+
// Ensure empty dataset placement falls back to the runtime default mode.
108114
value := &Alluxio{}
109115

110116
(&AlluxioEngine{}).transformPlacementMode(&datav1alpha1.Dataset{}, value)
@@ -115,6 +121,7 @@ var _ = Describe("Alluxio engine and transform file scope", Label("pkg.ddc.allux
115121

116122
Describe("transform", func() {
117123
It("builds an alluxio value for a dataset-backed runtime", func() {
124+
// Cover the file-scope transform path, including mount, config, pod metadata, and tiered-store wiring.
118125
namespacedName := types.NamespacedName{Name: "demo", Namespace: "fluid"}
119126
dataset, runtime := mockFluidObjectsForTests(namespacedName)
120127
dataset.Spec.PlacementMode = ""

0 commit comments

Comments
 (0)