Skip to content

Commit fdbd38c

Browse files
committed
Add comments to TestCheckMasterReady in pkg/ddc/alluxio/master_test.go
1 parent 8ea0f29 commit fdbd38c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

pkg/ddc/alluxio/master_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,23 @@ import (
2626
"k8s.io/apimachinery/pkg/runtime"
2727
)
2828

29+
// TestCheckMasterReady tests the CheckMasterReady method of the AlluxioEngine.
30+
// It simulates different runtime environments using fake Kubernetes clients and
31+
// verifies whether the engine correctly determines the readiness of the master component.
32+
//
33+
// Parameters:
34+
// - t *testing.T: Standard testing object used for logging and test failure reporting.
35+
//
36+
// Return: None (standard Go testing function).
37+
//
38+
// Notes:
39+
// - Uses a fake client to mock interactions with the Kubernetes API server.
40+
// - Creates multiple AlluxioRuntime and StatefulSet objects with specific ready states.
41+
// - Tests two scenarios:
42+
// 1. A runtime with insufficient master replicas should result in false readiness.
43+
// 2. A runtime with all required master replicas ready should result in true readiness.
44+
// - Also verifies that when readiness is true, the runtime's status conditions are updated correctly.
45+
// - Fails the test if actual readiness does not match the expected result or if status update is missing.
2946
func TestCheckMasterReady(t *testing.T) {
3047
statefulsetInputs := []v1.StatefulSet{
3148
{

0 commit comments

Comments
 (0)