From a8a4eedf8c97852389ea5f2c252660d3616af041 Mon Sep 17 00:00:00 2001 From: Alex Vaghin Date: Tue, 16 Aug 2016 22:51:58 +0200 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- acme/autocert/autocert_test.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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 @@ 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: }