-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plumb contexts into health checks (#4141)
- Loading branch information
Showing
7 changed files
with
179 additions
and
120 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
package checks | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
) | ||
|
||
func TestFileChecker(t *testing.T) { | ||
if err := FileChecker("/tmp").Check(); err == nil { | ||
if err := FileChecker("/tmp").Check(context.Background()); err == nil { | ||
t.Errorf("/tmp was expected as exists") | ||
} | ||
|
||
if err := FileChecker("NoSuchFileFromMoon").Check(); err != nil { | ||
if err := FileChecker("NoSuchFileFromMoon").Check(context.Background()); 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", 200, 0, nil).Check(); err == nil { | ||
if err := HTTPChecker("https://www.google.cybertron", 200, 0, nil).Check(context.Background()); err == nil { | ||
t.Errorf("Google on Cybertron was expected as not exists") | ||
} | ||
|
||
if err := HTTPChecker("https://www.google.pt", 200, 0, nil).Check(); err != nil { | ||
if err := HTTPChecker("https://www.google.pt", 200, 0, nil).Check(context.Background()); err != nil { | ||
t.Errorf("Google at Portugal was expected as exists, error:%v", err) | ||
} | ||
} |
This file contains 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
Oops, something went wrong.