()
| 49 | func mockConfig_withTLS() {} |
| 50 | |
| 51 | func ExampleConfig_withTLS() { |
| 52 | forUnitTestsRunInMockedContext(mockConfig_withTLS, func() { |
| 53 | tlsInfo := transport.TLSInfo{ |
| 54 | CertFile: "/tmp/test-certs/test-name-1.pem", |
| 55 | KeyFile: "/tmp/test-certs/test-name-1-key.pem", |
| 56 | TrustedCAFile: "/tmp/test-certs/trusted-ca.pem", |
| 57 | } |
| 58 | tlsConfig, err := tlsInfo.ClientConfig() |
| 59 | if err != nil { |
| 60 | log.Fatal(err) |
| 61 | } |
| 62 | cli, err := clientv3.New(clientv3.Config{ |
| 63 | Endpoints: exampleEndpoints(), |
| 64 | DialTimeout: dialTimeout, |
| 65 | TLS: tlsConfig, |
| 66 | }) |
| 67 | if err != nil { |
| 68 | log.Fatal(err) |
| 69 | } |
| 70 | defer cli.Close() // make sure to close the client |
| 71 | |
| 72 | _, err = cli.Put(context.TODO(), "foo", "bar") |
| 73 | if err != nil { |
| 74 | log.Fatal(err) |
| 75 | } |
| 76 | }) |
| 77 | // Without the line below the test is not being executed |
| 78 | // Output: |
| 79 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…