veyron/security: Fix flaky test.
Flakiness was caused by flakiness of IncorrectPasswordError in standard
library crypto/x509. Solution is to just compare the returned error to nil.
Will notify go folks.
Change-Id: I9f7430bd8868eb7b9bf9253ae35efc9454c88499
diff --git a/security/util_test.go b/security/util_test.go
index f4e2aec..117ee68 100644
--- a/security/util_test.go
+++ b/security/util_test.go
@@ -5,7 +5,6 @@
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
- "crypto/x509"
"fmt"
"reflect"
"testing"
@@ -45,8 +44,8 @@
t.Fatalf("Failed to save ECDSA private key: %v", err)
}
loadedKey, err := loadPEMKey(&buf, incorrect_pass)
- if loadedKey != nil && err != x509.IncorrectPasswordError {
- t.Errorf("expected (nil, x509.IncorrectPasswordError) received (%v,%v)", loadedKey, err)
+ if loadedKey != nil && err != nil {
+ t.Errorf("expected (nil, err != nil) received (%v,%v)", loadedKey, err)
}
// Test correct password.