diff --git a/pkg/ddc/juicefs/cache_test.go b/pkg/ddc/juicefs/cache_test.go index 8795f9f0c27..b57231e092c 100644 --- a/pkg/ddc/juicefs/cache_test.go +++ b/pkg/ddc/juicefs/cache_test.go @@ -33,6 +33,24 @@ import ( "github.com/fluid-cloudnative/fluid/pkg/utils/fake" ) +// TestJuiceFSEngine_queryCacheStatus tests the queryCacheStatus method of JuiceFSEngine +// +// The test is divided into two scenarios: +// 1. queryCacheStatus success case: +// - Creates a mock JuiceFSRuntime environment +// - Mocks various engine methods: +// - GetRunningPodsOfDaemonset to return mock pods +// - GetPodMetrics to return mock metrics +// - GetRunningPodsOfStatefulSet to return mock pods +// - GetEdition to return "enterprise" +// - Verifies the returned cacheStates matches expected values +// +// 2. queryCacheStatus with tiered store case: +// - Similar setup but with tiered store configuration +// - Verifies different expected cacheStates values +// +// The test uses goconvey framework for BDD-style testing +// Each scenario checks both error cases and the correctness of returned cache states func TestJuiceFSEngine_queryCacheStatus(t *testing.T) { Convey("Test queryCacheStatus ", t, func() { Convey("queryCacheStatus success", func() {