5d5caa0e9a
Signed-off-by: Hu Keping <hukeping@huawei.com>
25 lines
648 B
Go
25 lines
648 B
Go
package checks
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestFileChecker(t *testing.T) {
|
|
if err := FileChecker("/tmp").Check(); err == nil {
|
|
t.Errorf("/tmp was expected as exists")
|
|
}
|
|
|
|
if err := FileChecker("NoSuchFileFromMoon").Check(); err != nil {
|
|
t.Errorf("NoSuchFileFromMoon was expected as not exists, error:%v", err)
|
|
}
|
|
}
|
|
|
|
func TestHTTPChecker(t *testing.T) {
|
|
if err := HTTPChecker("https://www.google.cybertron").Check(); err == nil {
|
|
t.Errorf("Google on Cybertron was expected as not exists")
|
|
}
|
|
|
|
if err := HTTPChecker("https://www.google.pt").Check(); err != nil {
|
|
t.Errorf("Google at Portugal was expected as exists, error:%v", err)
|
|
}
|
|
}
|