@@ -17,6 +17,7 @@ limitations under the License.
1717package juicefs
1818
1919import (
20+ "encoding/json"
2021 "os"
2122 "path/filepath"
2223 "reflect"
@@ -25,14 +26,15 @@ import (
2526
2627 "github.com/fluid-cloudnative/fluid/pkg/common"
2728
28- datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
29- cdataload "github.com/fluid-cloudnative/fluid/pkg/dataload"
30- cruntime "github.com/fluid-cloudnative/fluid/pkg/runtime"
31- "github.com/fluid-cloudnative/fluid/pkg/utils/fake"
3229 appsv1 "k8s.io/api/apps/v1"
3330 v1 "k8s.io/api/core/v1"
3431 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3532 "k8s.io/apimachinery/pkg/runtime"
33+
34+ datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
35+ cdataload "github.com/fluid-cloudnative/fluid/pkg/dataload"
36+ cruntime "github.com/fluid-cloudnative/fluid/pkg/runtime"
37+ "github.com/fluid-cloudnative/fluid/pkg/utils/fake"
3638)
3739
3840var valuesConfigMapData = `
@@ -561,7 +563,7 @@ func TestJuiceFSEngine_genDataLoadValue(t *testing.T) {
561563 ImagePullSecrets : []v1.LocalObjectReference {},
562564 Options : map [string ]string {
563565 // dataload spec options
564- "dl-opts-k-1" : " dl-opts-v-1" ,
566+ "option" : "-- dl-opts-k-1= dl-opts-v-1" ,
565567 // cache info
566568 Edition : CommunityEdition ,
567569 "cache-info-k1" : "cache-info-v1" ,
@@ -728,7 +730,7 @@ func TestJuiceFSEngine_genDataLoadValue(t *testing.T) {
728730 },
729731 Options : map [string ]string {
730732 // dataload spec options
731- "dl-opts-k-1" : " dl-opts-v-1" ,
733+ "option" : "-- dl-opts-k-1= dl-opts-v-1" ,
732734 // cache info
733735 Edition : CommunityEdition ,
734736 "cache-info-k1" : "cache-info-v1" ,
@@ -829,7 +831,7 @@ func TestJuiceFSEngine_genDataLoadValue(t *testing.T) {
829831 },
830832 Options : map [string ]string {
831833 // dataload spec options
832- "dl-opts-k-1" : " dl-opts-v-1" ,
834+ "option" : "-- dl-opts-k-1= dl-opts-v-1" ,
833835 // cache info
834836 Edition : CommunityEdition ,
835837 "cache-info-k1" : "cache-info-v1" ,
@@ -938,7 +940,7 @@ func TestJuiceFSEngine_genDataLoadValue(t *testing.T) {
938940 },
939941 Options : map [string ]string {
940942 // dataload spec options
941- "dl-opts-k-1" : " dl-opts-v-1" ,
943+ "option" : "-- dl-opts-k-1= dl-opts-v-1" ,
942944 // cache info
943945 Edition : CommunityEdition ,
944946 "cache-info-k1" : "cache-info-v1" ,
@@ -961,7 +963,9 @@ func TestJuiceFSEngine_genDataLoadValue(t *testing.T) {
961963 }
962964 got , _ := engine .genDataLoadValue (item .image , item .cacheInfo , item .pods , item .targetDataset , item .dataload )
963965 if ! reflect .DeepEqual (got , item .want ) {
964- t .Errorf ("case %s, got %v,want:%v" , k , got , item .want )
966+ gotJson , _ := json .Marshal (got )
967+ wantJson , _ := json .Marshal (item .want )
968+ t .Errorf ("case %s, got %v\n want:%v" , k , string (gotJson ), string (wantJson ))
965969 }
966970 }
967971}
0 commit comments