@@ -303,6 +303,7 @@ func TestCleanUpFuse(t *testing.T) {
303303 log logr.Logger
304304 runtimeType string
305305 nodeInputs []* corev1.Node
306+ fuseLaunchMode datav1alpha1.FuseLaunchMode
306307 }{
307308 {
308309 wantedCount : 1 ,
@@ -324,8 +325,9 @@ func TestCleanUpFuse(t *testing.T) {
324325 "node-select" : "true" ,
325326 },
326327 },
327- log : fake .NullLogger (),
328- runtimeType : "jindo" ,
328+ log : fake .NullLogger (),
329+ runtimeType : "jindo" ,
330+ fuseLaunchMode : datav1alpha1 .LazyMode ,
329331 nodeInputs : []* corev1.Node {
330332 {
331333 ObjectMeta : metav1.ObjectMeta {
@@ -378,8 +380,9 @@ func TestCleanUpFuse(t *testing.T) {
378380 "node-select" : "true" ,
379381 },
380382 },
381- log : fake .NullLogger (),
382- runtimeType : "alluxio" ,
383+ log : fake .NullLogger (),
384+ runtimeType : "alluxio" ,
385+ fuseLaunchMode : datav1alpha1 .LazyMode ,
383386 nodeInputs : []* corev1.Node {
384387 {
385388 ObjectMeta : metav1.ObjectMeta {
@@ -434,8 +437,9 @@ func TestCleanUpFuse(t *testing.T) {
434437 "node-select" : "true" ,
435438 },
436439 },
437- log : fake .NullLogger (),
438- runtimeType : "goosefs" ,
440+ log : fake .NullLogger (),
441+ runtimeType : "goosefs" ,
442+ fuseLaunchMode : datav1alpha1 .LazyMode ,
439443 nodeInputs : []* corev1.Node {
440444 {
441445 ObjectMeta : metav1.ObjectMeta {
@@ -469,6 +473,63 @@ func TestCleanUpFuse(t *testing.T) {
469473 },
470474 },
471475 },
476+ {
477+ wantedCount : 0 ,
478+ name : "hadoop" ,
479+ namespace : "fluid" ,
480+ wantedNodeLabels : map [string ]map [string ]string {
481+ "no-fuse" : {},
482+ "multiple-fuse" : {
483+ "fluid.io/f-fluid-spark" : "true" ,
484+ "node-select" : "true" ,
485+ "fluid.io/f-fluid-hadoop" : "true" ,
486+ "fluid.io/s-fluid-hadoop" : "true" ,
487+ "fluid.io/s-h-juicefs-d-fluid-hadoop" : "5B" ,
488+ "fluid.io/s-h-juicefs-m-fluid-hadoop" : "1B" ,
489+ "fluid.io/s-h-juicefs-t-fluid-hadoop" : "6B" ,
490+ },
491+ "fuse" : {
492+ "fluid.io/dataset-num" : "1" ,
493+ "fluid.io/f-fluid-spark" : "true" ,
494+ "node-select" : "true" ,
495+ },
496+ },
497+ log : fake .NullLogger (),
498+ runtimeType : "juicefs" ,
499+ fuseLaunchMode : datav1alpha1 .EagerMode ,
500+ nodeInputs : []* corev1.Node {
501+ {
502+ ObjectMeta : metav1.ObjectMeta {
503+ Name : "no-fuse" ,
504+ Labels : map [string ]string {},
505+ },
506+ },
507+ {
508+ ObjectMeta : metav1.ObjectMeta {
509+ Name : "multiple-fuse" ,
510+ Labels : map [string ]string {
511+ "fluid.io/f-fluid-spark" : "true" ,
512+ "node-select" : "true" ,
513+ "fluid.io/f-fluid-hadoop" : "true" ,
514+ "fluid.io/s-fluid-hadoop" : "true" ,
515+ "fluid.io/s-h-juicefs-d-fluid-hadoop" : "5B" ,
516+ "fluid.io/s-h-juicefs-m-fluid-hadoop" : "1B" ,
517+ "fluid.io/s-h-juicefs-t-fluid-hadoop" : "6B" ,
518+ },
519+ },
520+ },
521+ {
522+ ObjectMeta : metav1.ObjectMeta {
523+ Name : "fuse" ,
524+ Labels : map [string ]string {
525+ "fluid.io/dataset-num" : "1" ,
526+ "fluid.io/f-fluid-spark" : "true" ,
527+ "node-select" : "true" ,
528+ },
529+ },
530+ },
531+ },
532+ },
472533 }
473534 for _ , test := range testCase {
474535
@@ -488,6 +549,7 @@ func TestCleanUpFuse(t *testing.T) {
488549 if err != nil {
489550 t .Errorf ("build runtime info error %v" , err )
490551 }
552+ runtimeInfo .SetFuseLaunchMode (test .fuseLaunchMode )
491553 h := & Helper {
492554 runtimeInfo : runtimeInfo ,
493555 client : fakeClient ,
0 commit comments