Skip to content

Commit

Permalink
WIP. Use an IS_TESTING env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
justinclift committed Jan 25, 2024
1 parent 2665f08 commit bf9cea1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/dio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ func (s *DioSuite) SetUpSuite(c *chk.C) {
log.Fatalln(err)
}
TLSConfig.Certificates = []tls.Certificate{cert}

// Load our self signed CA Cert chain, and set TLS1.2 as minimum
TLSConfig = tls.Config{
Certificates: []tls.Certificate{cert},
ClientCAs: ourCAPool,
InsecureSkipVerify: true,
MinVersion: tls.VersionTLS12,
PreferServerCipherSuites: true,
RootCAs: ourCAPool,
}

var email string
certUser, email, _, err = getUserAndServer()
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ func init() {
// Add support for pretty printing numbers
numFormat = message.NewPrinter(message.MatchLanguage("en"))

// When run from go test we skip this, as we generate a temporary config file in the test suite setup
if os.Getenv("IS_TESTING") == "yes" {
return
}

// Add the global environment variables
RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "",
fmt.Sprintf("config file (default is %s)", filepath.Join("$HOME", ".dio", "config.toml")))
Expand Down

0 comments on commit bf9cea1

Please sign in to comment.