forked from fluid-cloudnative/fluid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a test case (fluid-cloudnative#1036)
Signed-off-by: yangyuliufeng <[email protected]>
- Loading branch information
1 parent
90ed32d
commit f8adea7
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package base | ||
|
||
import ( | ||
datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1" | ||
"testing" | ||
) | ||
|
||
func TestGetPersistentVolumeName(t *testing.T) { | ||
var testCases = []struct { | ||
runtimeName string | ||
runtimeNamespace string | ||
isDeprecatedPVName bool | ||
expectedPVName string | ||
}{ | ||
{ | ||
runtimeName: "spark", | ||
runtimeNamespace: "fluid", | ||
isDeprecatedPVName: false, | ||
expectedPVName: "fluid-spark", | ||
}, | ||
{ | ||
runtimeName: "hadoop", | ||
runtimeNamespace: "test", | ||
isDeprecatedPVName: false, | ||
expectedPVName: "test-hadoop", | ||
}, | ||
{ | ||
runtimeName: "hbase", | ||
runtimeNamespace: "fluid", | ||
isDeprecatedPVName: true, | ||
expectedPVName: "hbase", | ||
}, | ||
|
||
} | ||
for _, testCase := range testCases { | ||
runtimeInfo, err := BuildRuntimeInfo(testCase.runtimeName, testCase.runtimeNamespace, "alluxio", datav1alpha1.TieredStore{}) | ||
if err != nil { | ||
t.Errorf("fail to create the runtimeInfo with error %v", err) | ||
} | ||
runtimeInfo.SetDeprecatedPVName(testCase.isDeprecatedPVName) | ||
result := runtimeInfo.GetPersistentVolumeName() | ||
if result != testCase.expectedPVName { | ||
t.Errorf("get failure, expected %s, get %s", testCase.expectedPVName, result) | ||
} | ||
} | ||
} |