mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Fix wallet check for Windows by addresses differences in error message text (#7461)
* fix * test Co-authored-by: dv8silencer <15720668+dv8silencer@users.noreply.github.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
This commit is contained in:
parent
48fcb08ebc
commit
796c336a29
@ -130,7 +130,8 @@ func IsValid(walletDir string) (bool, error) {
|
||||
}
|
||||
f, err := os.Open(expanded)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "no such file") {
|
||||
if strings.Contains(err.Error(), "no such file") ||
|
||||
strings.Contains(err.Error(), "cannot find the path") {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
|
@ -132,12 +132,16 @@ func Test_IsValid_RandomFiles(t *testing.T) {
|
||||
randPath, err := rand.Int(rand.Reader, big.NewInt(1000000))
|
||||
require.NoError(t, err, "Could not generate random file path")
|
||||
path := filepath.Join(testutil.TempDir(), fmt.Sprintf("/%d", randPath), "wallet")
|
||||
valid, err := wallet.IsValid(path)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, false, valid)
|
||||
|
||||
t.Cleanup(func() {
|
||||
require.NoError(t, os.RemoveAll(path), "Failed to remove directory")
|
||||
})
|
||||
require.NoError(t, os.MkdirAll(path, params.BeaconIoConfig().ReadWriteExecutePermissions), "Failed to create directory")
|
||||
|
||||
valid, err := wallet.IsValid(path)
|
||||
valid, err = wallet.IsValid(path)
|
||||
require.ErrorContains(t, "no wallet found at path", err)
|
||||
require.Equal(t, false, valid)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user