Merge branch '22174-remove-actions-column'
[arvados.git] / sdk / go / arvados / tls_certs_test.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package arvados
6
7 import (
8         "os"
9         "os/exec"
10
11         check "gopkg.in/check.v1"
12 )
13
14 type tlsCertsSuite struct{}
15
16 var _ = check.Suite(&tlsCertsSuite{})
17
18 func (s *tlsCertsSuite) TestCustomCert(c *check.C) {
19         certfile := "/etc/arvados/ca-certificates.crt"
20         if _, err := os.Stat(certfile); err != nil {
21                 c.Skip("custom cert file " + certfile + " does not exist")
22         }
23         out, err := exec.Command("bash", "-c", "SSL_CERT_FILE= go run tls_certs_test_showenv.go").CombinedOutput()
24         c.Logf("%s", out)
25         c.Assert(err, check.IsNil)
26         c.Check(string(out), check.Equals, certfile+"\n")
27
28         out, err = exec.Command("bash", "-c", "SSL_CERT_FILE=/dev/null go run tls_certs_test_showenv.go").CombinedOutput()
29         c.Logf("%s", out)
30         c.Assert(err, check.IsNil)
31         c.Check(string(out), check.Equals, "/dev/null\n")
32 }