fix error message check in tests

This commit is contained in:
Tigran 2023-09-13 19:54:01 +04:00
parent ecbd067f5b
commit 9fcc89f876
1 changed files with 3 additions and 3 deletions

View File

@ -940,7 +940,7 @@ func TestMemMapFsRemove(t *testing.T) {
"/parent1/parent2", "/parent1/parent2",
"/parent1/parent2/fileForDelete1.txt", "/parent1/parent2/fileForDelete1.txt",
}, },
expectedErrMsg: "remove /parent1/parent2/fileForDelete1.txt: file does not exist", expectedErrMsg: "fileForDelete1.txt: file does not exist",
}, },
"Remove root and then parent1 - should return error": { "Remove root and then parent1 - should return error": {
dirsToCreate: []string{"/root/parent1/parent2/fileForDelete1.txt"}, dirsToCreate: []string{"/root/parent1/parent2/fileForDelete1.txt"},
@ -948,7 +948,7 @@ func TestMemMapFsRemove(t *testing.T) {
"/root", "/root",
"/root/parent1", "/root/parent1",
}, },
expectedErrMsg: "remove /root/parent1: file does not exist", expectedErrMsg: "parent1: file does not exist",
}, },
"Remove parent2 and then parent 1 - success": { "Remove parent2 and then parent 1 - success": {
dirsToCreate: []string{"/parent1/parent2/fileForDelete1.txt"}, dirsToCreate: []string{"/parent1/parent2/fileForDelete1.txt"},
@ -979,7 +979,7 @@ func TestMemMapFsRemove(t *testing.T) {
for _, toRemove := range td.dirsToRemove { for _, toRemove := range td.dirsToRemove {
err = fs.Remove(toRemove) err = fs.Remove(toRemove)
if err != nil && err.Error() != td.expectedErrMsg { if err != nil && !strings.Contains(err.Error(), td.expectedErrMsg) {
t.Fatalf("#CASE %v %s: Remove %q failed: %v", caseName, fs.Name(), toRemove, err) t.Fatalf("#CASE %v %s: Remove %q failed: %v", caseName, fs.Name(), toRemove, err)
} }
} }