@@ -27,6 +27,18 @@ import (
2727 "k8s.io/apimachinery/pkg/runtime"
2828)
2929
30+ // TestUpdateCacheOfDataset: Tests the UpdateCacheOfDataset method of JuiceFSEngine
31+ // This test creates mock datasets and runtime objects, invokes UpdateCacheOfDataset,
32+ // and verifies the cache state updates in the dataset status.
33+ //
34+ // TestUpdateDatasetStatus: Tests the UpdateDatasetStatus method of JuiceFSEngine
35+ // This test simulates different dataset phases (Bound/Failed/None) and verifies
36+ // the status field updates in the dataset.
37+ //
38+ // TestBindToDataset: Tests the BindToDataset method of JuiceFSEngine
39+ // This test initializes datasets and runtime objects, invokes BindToDataset,
40+ // and verifies the dataset status transitions to Bound phase with correct cache states.
41+
3042func TestUpdateCacheOfDataset (t * testing.T ) {
3143 testDatasetInputs := []* datav1alpha1.Dataset {
3244 {
@@ -245,16 +257,6 @@ func TestUpdateDatasetStatus(t *testing.T) {
245257 }
246258}
247259
248- // TestBindToDataset verifies the functionality of the BindToDataset method in the JuiceFSEngine struct.
249- // It initializes test datasets and JuiceFS runtime objects, creates a fake client, and invokes the method.
250- // The test checks if the dataset's status is updated correctly to the expected bound phase, with cache states
251- // and HCFS status properly reflected. If the function does not produce the expected results, it logs an error.
252- //
253- // Parameters:
254- // - t *testing.T: The testing framework's instance used to report errors and manage test execution.
255- //
256- // Returns:
257- // - This function does not return a value but reports test failures using t.Errorf().
258260func TestBindToDataset (t * testing.T ) {
259261 testDatasetInputs := []* datav1alpha1.Dataset {
260262 {
0 commit comments