fix: TestExecutable on Windows - expected error message is wrong (#3272)

Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
This commit is contained in:
Diógenes Fernandes
2025-09-16 13:27:18 -03:00
committed by GitHub
parent 8b459587ca
commit d280ab1d6b

View File

@@ -6,6 +6,7 @@
package providercache
import (
"runtime"
"syscall"
"testing"
@@ -103,7 +104,7 @@ func TestExecutableFile(t *testing.T) {
Version: getproviders.MustParseVersion("2.0.0"),
PackageDir: "testdata/cachedir/registry.opentofu.org/missing/packagedir/2.0.0/linux_amd64",
},
err: "could not read package directory: open testdata/cachedir/registry.opentofu.org/missing/packagedir/2.0.0/linux_amd64: " + syscall.ENOENT.Error(),
err: "could not read package directory: open testdata/cachedir/registry.opentofu.org/missing/packagedir/2.0.0/linux_amd64: " + missingDirError(),
},
}
@@ -121,3 +122,10 @@ func TestExecutableFile(t *testing.T) {
})
}
}
func missingDirError() string {
if runtime.GOOS == "windows" {
return syscall.ENOTDIR.Error()
}
return syscall.ENOENT.Error()
}