mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 10:11:03 +00:00
Merge pull request #332 from weaveworks/dont-panic-on-darwin
Don't panic tests on Darwin.
This commit is contained in:
@@ -122,7 +122,7 @@ func (c *container) StartGatheringStats() error {
|
||||
return
|
||||
}
|
||||
|
||||
dial, err := net.Dial(url.Scheme, url.Path)
|
||||
dial, err := DialStub(url.Scheme, url.Path)
|
||||
if err != nil {
|
||||
log.Printf("docker container: %v", err)
|
||||
return
|
||||
|
||||
@@ -4,6 +4,8 @@ import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"runtime"
|
||||
@@ -31,6 +33,8 @@ func (c *mockConnection) Close() error {
|
||||
}
|
||||
|
||||
func TestContainer(t *testing.T) {
|
||||
log.SetOutput(ioutil.Discard)
|
||||
|
||||
oldDialStub, oldNewClientConnStub := docker.DialStub, docker.NewClientConnStub
|
||||
defer func() { docker.DialStub, docker.NewClientConnStub = oldDialStub, oldNewClientConnStub }()
|
||||
|
||||
|
||||
@@ -8,6 +8,17 @@ import (
|
||||
"github.com/weaveworks/scope/test"
|
||||
)
|
||||
|
||||
func TestBasicWalk(t *testing.T) {
|
||||
// Don't panic or error.
|
||||
var (
|
||||
procRoot = "/proc"
|
||||
procFunc = func(process.Process) {}
|
||||
)
|
||||
if err := process.NewWalker(procRoot).Walk(procFunc); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCache(t *testing.T) {
|
||||
processes := []process.Process{
|
||||
{PID: 1, PPID: 0, Comm: "init"},
|
||||
|
||||
Reference in New Issue
Block a user