LEFT | RIGHT |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package tls | 5 package tls |
6 | 6 |
7 import ( | 7 import ( |
8 "testing" | 8 "testing" |
9 ) | 9 ) |
10 | 10 |
11 // For now, only here to exercise the cgo-based | 11 var tlsServers = []string{ |
12 // root certificate fetcher. Mainly to make sure | 12 » "google.com:443", |
13 // they don't crash. | 13 » "github.com:443", |
14 // | 14 » "twitter.com:443", |
15 // x509.CertPool is not easily testable in isolation. | 15 } |
| 16 |
16 func TestOSCertBundles(t *testing.T) { | 17 func TestOSCertBundles(t *testing.T) { |
17 » roots := defaultRoots() | 18 » defaultRoots() |
18 » _ = roots | 19 |
| 20 » if testing.Short() { |
| 21 » » t.Logf("skipping certificate tests in short mode") |
| 22 » » return |
| 23 » } |
| 24 |
| 25 » for _, addr := range tlsServers { |
| 26 » » conn, err := Dial("tcp", addr, nil) |
| 27 » » if err != nil { |
| 28 » » » t.Errorf("unable to verify %v: %v", addr, err) |
| 29 » » » continue |
| 30 » » } |
| 31 » » err = conn.Close() |
| 32 » » if err != nil { |
| 33 » » » t.Error(err) |
| 34 » » } |
| 35 » } |
19 } | 36 } |
LEFT | RIGHT |