Skip to content

Commit cfa6d47

Browse files
authored
Extend CacheRuntime phase 2.1: add test for component and remove unnecessary schema field for component (#5809)
* remove schema for component and add test for component Signed-off-by: xliuqq <xlzq1992@gmail.com> * fix fmt Signed-off-by: xliuqq <xlzq1992@gmail.com> * fix review issues Signed-off-by: xliuqq <xlzq1992@gmail.com> * fix test names Signed-off-by: xliuqq <xlzq1992@gmail.com> --------- Signed-off-by: xliuqq <xlzq1992@gmail.com>
1 parent c344236 commit cfa6d47

11 files changed

Lines changed: 637 additions & 147 deletions

File tree

pkg/ddc/cache/component/component_manager.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ package component
1818

1919
import (
2020
"context"
21+
2122
"github.com/fluid-cloudnative/fluid/api/v1alpha1"
2223
"github.com/fluid-cloudnative/fluid/pkg/common"
2324
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24-
"k8s.io/apimachinery/pkg/runtime"
2525
"sigs.k8s.io/controller-runtime/pkg/client"
2626
)
2727

@@ -30,16 +30,16 @@ type ComponentManager interface {
3030
ConstructComponentStatus(todo context.Context, value *common.CacheRuntimeComponentValue) (v1alpha1.RuntimeComponentStatus, error)
3131
}
3232

33-
func NewComponentHelper(workloadType metav1.TypeMeta, scheme *runtime.Scheme, client client.Client) ComponentManager {
33+
func NewComponentHelper(workloadType metav1.TypeMeta, client client.Client) ComponentManager {
3434
if workloadType.APIVersion == "apps/v1" {
3535
if workloadType.Kind == "StatefulSet" {
36-
return newStatefulSetManager(scheme, client)
36+
return newStatefulSetManager(client)
3737
} else if workloadType.Kind == "DaemonSet" {
38-
return newDaemonSetManager(scheme, client)
38+
return newDaemonSetManager(client)
3939
}
4040
}
4141

42-
return newStatefulSetManager(scheme, client)
42+
return newStatefulSetManager(client)
4343
}
4444

4545
// getCommonLabelsFromComponent returns the common labels for component used for stateful
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
Copyright 2026 The Fluid Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package component
18+
19+
import (
20+
"testing"
21+
22+
. "github.com/onsi/ginkgo/v2"
23+
. "github.com/onsi/gomega"
24+
)
25+
26+
func TestCacheComponent(t *testing.T) {
27+
RegisterFailHandler(Fail)
28+
RunSpecs(t, "Cache Component Suite", Label("cache-component"))
29+
}

0 commit comments

Comments
 (0)