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>
diff --git a/acme/autocert/autocert_test.go b/acme/autocert/autocert_test.go
index 6059feb..ffe5d97 100644
--- a/acme/autocert/autocert_test.go
+++ b/acme/autocert/autocert_test.go
@@ -48,7 +48,8 @@
 }`))
 
 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 @@
 		}
 	}))
 	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 @@
 		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:
 	}