...

Source file src/github.com/docker/distribution/health/checks/checks_test.go

Documentation: github.com/docker/distribution/health/checks

     1  package checks
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestFileChecker(t *testing.T) {
     8  	if err := FileChecker("/tmp").Check(); err == nil {
     9  		t.Errorf("/tmp was expected as exists")
    10  	}
    11  
    12  	if err := FileChecker("NoSuchFileFromMoon").Check(); err != nil {
    13  		t.Errorf("NoSuchFileFromMoon was expected as not exists, error:%v", err)
    14  	}
    15  }
    16  
    17  func TestHTTPChecker(t *testing.T) {
    18  	if err := HTTPChecker("https://www.google.cybertron", 200, 0, nil).Check(); err == nil {
    19  		t.Errorf("Google on Cybertron was expected as not exists")
    20  	}
    21  
    22  	if err := HTTPChecker("https://www.google.pt", 200, 0, nil).Check(); err != nil {
    23  		t.Errorf("Google at Portugal was expected as exists, error:%v", err)
    24  	}
    25  }
    26  

View as plain text