Skip to content

Commit db64172

Browse files
chole-delchole
andauthored
Add comments to TestUpdateDatasetStatus on pkg\ddc\jindo\dataset_test.go (#4669)
Signed-off-by: chole <11876014+chole_1@user.noreply.gitee.com> Co-authored-by: chole <11876014+chole_1@user.noreply.gitee.com>
1 parent 637bd92 commit db64172

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pkg/ddc/jindo/dataset_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,24 @@ func TestUpdateCacheOfDataset(t *testing.T) {
116116
}
117117
}
118118

119+
// TestUpdateDatasetStatus tests the UpdateDatasetStatus method of JindoEngine to ensure correct
120+
// dataset status updates under various phases. It validates:
121+
// 1. Phase transitions (Bound, Failed, None)
122+
// 2. Preservation of HCFS status fields during updates
123+
// 3. Proper synchronization of cache states from runtime status
124+
//
125+
// Test strategy:
126+
// - Creates mock Dataset and JindoRuntime objects in a test namespace
127+
// - Uses a fake Kubernetes client to simulate API server interactions
128+
// - Verifies three key aspects of DatasetStatus after updates:
129+
// a) Phase matches expected state
130+
// b) CacheStates are properly propagated from runtime status
131+
// c) HCFSStatus fields remain unchanged during phase transitions
132+
//
133+
// Test cases cover:
134+
// - Successful bound state update
135+
// - Failure state handling
136+
// - Default/none state transition
119137
func TestUpdateDatasetStatus(t *testing.T) {
120138
testDatasetInputs := []*datav1alpha1.Dataset{
121139
{

0 commit comments

Comments
 (0)