Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions pkg/ddc/juicefs/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Loading