From 52728e6f8806b31ba15585476eb53bf2cf8f0ea6 Mon Sep 17 00:00:00 2001 From: ScarletDream <2863009812@qq.com> Date: Sun, 8 Jun 2025 19:38:24 +0800 Subject: [PATCH 1/2] Add Notation to TestJuiceFSEngine_queryCacheStatus in pkg/ddc/juicefs/cache_test.go Signed-off-by: ScarletDream <2863009812@qq.com> --- pkg/ddc/juicefs/cache_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/ddc/juicefs/cache_test.go b/pkg/ddc/juicefs/cache_test.go index 8795f9f0c27..f01740240ba 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() { From c9640209683144c7d8f9b81589f3cacb02aff468 Mon Sep 17 00:00:00 2001 From: cheyang Date: Wed, 6 Aug 2025 10:59:20 +0800 Subject: [PATCH 2/2] Go fmt pkg/ddc/juicefs/cache_test.go Signed-off-by: cheyang --- pkg/ddc/juicefs/cache_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/ddc/juicefs/cache_test.go b/pkg/ddc/juicefs/cache_test.go index f01740240ba..b57231e092c 100644 --- a/pkg/ddc/juicefs/cache_test.go +++ b/pkg/ddc/juicefs/cache_test.go @@ -37,17 +37,17 @@ import ( // // 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 +// - 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 +// - 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