This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Yaml | |
| viper.SetConfigType("yaml") | |
| // JSON | |
| viper.SetConfigType("json") | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | viper.SetConfigName("config-file-name"); | |
| viper.SetConfigName("config-file-name-2"); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | viper.AddConfigPath(".") | |
| viper.AddConfigPath("$HOME/.looped") | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | viper.SetConfigFile("./path/to/config-file.yaml") | |
| viper.SetConfigFile("./path/to/config-file-2.json") | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // hard kill the container in 3 minutes (180 Seconds) | |
| resource.Expire(180) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | resp, err := http.Get(fmt.Sprintf("http://localhost:%s/api/v2/messages", HTTP_PORT)) | |
| assert.Nil(t, err) | |
| defer resp.Body.Close() | |
| assert.Equal(t, 200, resp.StatusCode) | |
| body, err := ioutil.ReadAll(resp.Body) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | mail := Mail{ | |
| host: SMTP_HOST, | |
| port: SMTP_PORT, | |
| from: "from@example.com", | |
| password: "", | |
| username: "", | |
| } | |
| err := mail.Send([]string{"to@example.com"}, "Test Subject", "Sending an automated test email") | |
| assert.Nil(t, err) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | func TestMain(m *testing.M) { | |
| // uses a sensible default on windows (tcp/http) and linux/osx (socket) | |
| pool, err := dockertest.NewPool("") | |
| if err != nil { | |
| log.Fatalf("Could not connect to docker: %s", err) | |
| } | |
| // we will use a dockerfile to build the image for testing | |
| resource, err := pool.BuildAndRun("mailhog-test-server", "./Dockerfile", []string{}) | |
| if err != nil { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | os.Exit(code) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | if err := pool.Purge(resource); err != nil { | |
| log.Fatalf("Could not purge resource: %s", err) | |
| } |