2015-06-04 16:23:11 +00:00
|
|
|
package checks
|
|
|
|
|
|
|
|
import (
|
2023-10-27 19:44:25 +00:00
|
|
|
"context"
|
2015-06-04 16:23:11 +00:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestFileChecker(t *testing.T) {
|
2023-10-27 19:44:25 +00:00
|
|
|
if err := FileChecker("/tmp").Check(context.Background()); err == nil {
|
2015-06-04 16:23:11 +00:00
|
|
|
t.Errorf("/tmp was expected as exists")
|
|
|
|
}
|
|
|
|
|
2023-10-27 19:44:25 +00:00
|
|
|
if err := FileChecker("NoSuchFileFromMoon").Check(context.Background()); err != nil {
|
2015-06-04 16:23:11 +00:00
|
|
|
t.Errorf("NoSuchFileFromMoon was expected as not exists, error:%v", err)
|
|
|
|
}
|
|
|
|
}
|
2015-06-09 17:39:34 +00:00
|
|
|
|
|
|
|
func TestHTTPChecker(t *testing.T) {
|
2023-10-27 19:44:25 +00:00
|
|
|
if err := HTTPChecker("https://www.google.cybertron", 200, 0, nil).Check(context.Background()); err == nil {
|
2015-06-09 17:39:34 +00:00
|
|
|
t.Errorf("Google on Cybertron was expected as not exists")
|
|
|
|
}
|
|
|
|
|
2023-10-27 19:44:25 +00:00
|
|
|
if err := HTTPChecker("https://www.google.pt", 200, 0, nil).Check(context.Background()); err != nil {
|
2015-06-09 17:39:34 +00:00
|
|
|
t.Errorf("Google at Portugal was expected as exists, error:%v", err)
|
|
|
|
}
|
|
|
|
}
|