mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
rbd: use clusterID from volumeContext at nodestage
previously we were retriving clusterID using the monitors field in the volume context at node stage code path. however it is possible to retrieve or use clusterID directly from the volume context. This commit also remove the getClusterIDFromMigrationVolume() function which was used previously and its tests Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
4e61156dc4
commit
c584fa20da
@ -34,7 +34,6 @@ func cleanupTestData() {
|
||||
os.RemoveAll(basePath)
|
||||
}
|
||||
|
||||
// nolint:gocyclo,cyclop // TODO: make this function less complex.
|
||||
func TestCSIConfig(t *testing.T) {
|
||||
t.Parallel()
|
||||
var err error
|
||||
@ -139,35 +138,4 @@ func TestCSIConfig(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("Test setup error %s", err)
|
||||
}
|
||||
|
||||
// TEST: Should pass as clusterID is present in config
|
||||
content, err = readClusterInfoWithMon(pathToConfig, "mon1")
|
||||
if err != nil || content != "test2" {
|
||||
t.Errorf("Failed: want (%s), got (%s) (%v)", "test2", content, err)
|
||||
}
|
||||
|
||||
// TEST: Should pass as clusterID is present in config
|
||||
content, err = readClusterInfoWithMon(pathToConfig, "mon5")
|
||||
if err != nil || content != "test1" {
|
||||
t.Errorf("Failed: want (%s), got (%s) (%v)", "test1", content, err)
|
||||
}
|
||||
|
||||
// TEST: Should fail as clusterID is not present in config
|
||||
content, err = readClusterInfoWithMon(pathToConfig, "mon8")
|
||||
if err == nil {
|
||||
t.Errorf("Failed: got (%s)", content)
|
||||
}
|
||||
|
||||
data = "[{\"clusterID\":\"" + clusterID2 + "\", \"radosNamespace\": \"ns1\", \"monitors\":[\"mon1\"]}," +
|
||||
"{\"clusterID\":\"" + clusterID1 + "\",\"monitors\":[\"mon1\"]}]"
|
||||
err = ioutil.WriteFile(basePath+"/"+csiClusters, []byte(data), 0o600)
|
||||
if err != nil {
|
||||
t.Errorf("Test setup error %s", err)
|
||||
}
|
||||
|
||||
// TEST: Should pass as clusterID is present in config
|
||||
content, err = readClusterInfoWithMon(pathToConfig, "mon1")
|
||||
if err != nil || content != clusterID1 {
|
||||
t.Errorf("Failed: want (%s), got (%s) (%v)", "test2", content, err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user