mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
ci: Use temporary directory for unit tests
ensure a clean and isolated environment for testing purposes. Signed-off-by: Mayank Pal <mayankpal9654@gmail.com> ci: Use temporary directory for unit tests remove err = os.Mkdir('/etc/ceph-csi-config', 0o600) Signed-off-by: Mayank Pal <mayankpal9654@gmail.com> ci: Use temporary directory for unit tests remove err = os.Mkdir('/etc/ceph-csi-config', 0o600) Signed-off-by: Mayank Pal <mayankpal9654@gmail.com> ci: Use temporary directory for unit tests remove if err Signed-off-by: Mayank Pal <mayankpal9654@gmail.com>
This commit is contained in:
parent
a8e9d66009
commit
822794c242
@ -243,11 +243,8 @@ func TestReadAffinity_GetReadAffinityMapOptions(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to marshal csi config info %v", err)
|
t.Errorf("failed to marshal csi config info %v", err)
|
||||||
}
|
}
|
||||||
tmpConfPath := util.CsiConfigFile
|
tmpConfPath := t.TempDir() + "/ceph-csi.json"
|
||||||
err = os.Mkdir("/etc/ceph-csi-config", 0o600)
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("failed to create directory %s: %v", "/etc/ceph-csi-config", err)
|
|
||||||
}
|
|
||||||
err = os.WriteFile(tmpConfPath, csiConfigFileContent, 0o600)
|
err = os.WriteFile(tmpConfPath, csiConfigFileContent, 0o600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to write %s file content: %v", util.CsiConfigFile, err)
|
t.Errorf("failed to write %s file content: %v", util.CsiConfigFile, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user