@@ -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 {
@@ -250,16 +262,6 @@ func TestUpdateDatasetStatus(t *testing.T) {
250262 }
251263}
252264
253- // TestBindToDataset verifies the functionality of the BindToDataset method in the JuiceFSEngine struct.
254- // It initializes test datasets and JuiceFS runtime objects, creates a fake client, and invokes the method.
255- // The test checks if the dataset's status is updated correctly to the expected bound phase, with cache states
256- // and HCFS status properly reflected. If the function does not produce the expected results, it logs an error.
257- //
258- // Parameters:
259- // - t *testing.T: The testing framework's instance used to report errors and manage test execution.
260- //
261- // Returns:
262- // - This function does not return a value but reports test failures using t.Errorf().
263265func TestBindToDataset (t * testing.T ) {
264266 testDatasetInputs := []* datav1alpha1.Dataset {
265267 {
0 commit comments