acme/autocert: improve test speed on 386

This change makes the tests run considerably faster on GOARCH=386
by reducing test RSA keys to 512-bit size.

It also increases GetCertificate test timeout to allow for slower
computations.

Change-Id: I7a27ffa5130f9ba08ee2069dad29aed74fa8c521
Reviewed-on: https://go-review.googlesource.com/27094
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Alex Vaghin
2016-08-16 21:05:27 +00:00
committed by Brad Fitzpatrick
parent 1f83de14df
commit a8a4eedf8c
+13 -3
View File
@@ -48,7 +48,8 @@ var authzTmpl = template.Must(template.New("authz").Parse(`{
}`))
func dummyCert(san ...string) ([]byte, error) {
key, err := rsa.GenerateKey(rand.Reader, 2048)
// use smaller key to run faster on 386
key, err := rsa.GenerateKey(rand.Reader, 512)
if err != nil {
return nil, err
}
@@ -128,7 +129,16 @@ func TestGetCertificate(t *testing.T) {
}
}))
defer ca.Close()
man.Client = &acme.Client{DirectoryURL: ca.URL}
// use smaller key to run faster on 386
key, kerr := rsa.GenerateKey(rand.Reader, 512)
if kerr != nil {
t.Fatal(kerr)
}
man.Client = &acme.Client{
Key: key,
DirectoryURL: ca.URL,
}
// simulate tls.Config.GetCertificate
var (
@@ -142,7 +152,7 @@ func TestGetCertificate(t *testing.T) {
close(done)
}()
select {
case <-time.After(10 * time.Second):
case <-time.After(15 * time.Second):
t.Fatal("man.GetCertificate took too long to return")
case <-done:
}