From a35f4374c573d11a9ab281361a1615dbac32172c Mon Sep 17 00:00:00 2001 From: Victor Marmol Date: Fri, 6 Mar 2015 15:42:06 -0800 Subject: [PATCH] Update cAdvisor ContainerInfo references to v1 API. The cAdvisor data structures were versioned recently. We use the v1 versions so this commit makes that explicit. --- pkg/client/containerinfo.go | 2 +- pkg/client/containerinfo_test.go | 6 +++--- pkg/kubelet/cadvisor.go | 2 +- pkg/kubelet/kubelet_test.go | 2 +- pkg/kubelet/server.go | 2 +- pkg/kubelet/server_test.go | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/client/containerinfo.go b/pkg/client/containerinfo.go index a6dc2f681e5..89879811ad7 100644 --- a/pkg/client/containerinfo.go +++ b/pkg/client/containerinfo.go @@ -25,7 +25,7 @@ import ( "net/http" "strconv" - "github.com/google/cadvisor/info" + info "github.com/google/cadvisor/info/v1" ) type ContainerInfoGetter interface { diff --git a/pkg/client/containerinfo_test.go b/pkg/client/containerinfo_test.go index 43027f4b94b..8f0d5af4ba5 100644 --- a/pkg/client/containerinfo_test.go +++ b/pkg/client/containerinfo_test.go @@ -28,8 +28,8 @@ import ( "testing" "time" - "github.com/google/cadvisor/info" - itest "github.com/google/cadvisor/info/test" + info "github.com/google/cadvisor/info/v1" + itest "github.com/google/cadvisor/info/v1/test" ) func testHTTPContainerInfoGetter( @@ -62,7 +62,7 @@ func testHTTPContainerInfoGetter( // So changing req after Get*Info would be a race. expectedReq := req // Fill any empty fields with default value - if !reflect.DeepEqual(expectedReq, &receivedReq) { + if !expectedReq.Equals(receivedReq) { t.Errorf("received wrong request") } err = json.NewEncoder(w).Encode(cinfo) diff --git a/pkg/kubelet/cadvisor.go b/pkg/kubelet/cadvisor.go index dea20db07dc..5242fcbf96a 100644 --- a/pkg/kubelet/cadvisor.go +++ b/pkg/kubelet/cadvisor.go @@ -22,7 +22,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools" "github.com/GoogleCloudPlatform/kubernetes/pkg/types" - cadvisor "github.com/google/cadvisor/info" + cadvisor "github.com/google/cadvisor/info/v1" ) var ( diff --git a/pkg/kubelet/kubelet_test.go b/pkg/kubelet/kubelet_test.go index 1098b40569b..79f6b42af43 100644 --- a/pkg/kubelet/kubelet_test.go +++ b/pkg/kubelet/kubelet_test.go @@ -41,7 +41,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util" "github.com/fsouza/go-dockerclient" - "github.com/google/cadvisor/info" + info "github.com/google/cadvisor/info/v1" "github.com/stretchr/testify/mock" ) diff --git a/pkg/kubelet/server.go b/pkg/kubelet/server.go index 271b7d79d02..1e9c0ecbc4b 100644 --- a/pkg/kubelet/server.go +++ b/pkg/kubelet/server.go @@ -39,7 +39,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream/spdy" "github.com/golang/glog" - "github.com/google/cadvisor/info" + info "github.com/google/cadvisor/info/v1" "github.com/prometheus/client_golang/prometheus" ) diff --git a/pkg/kubelet/server_test.go b/pkg/kubelet/server_test.go index 9816bed9fb1..035c95e4d51 100644 --- a/pkg/kubelet/server_test.go +++ b/pkg/kubelet/server_test.go @@ -34,7 +34,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/types" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream" "github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream/spdy" - "github.com/google/cadvisor/info" + info "github.com/google/cadvisor/info/v1" ) type fakeKubelet struct { @@ -210,7 +210,7 @@ func TestContainerInfo(t *testing.T) { if err != nil { t.Fatalf("received invalid json data: %v", err) } - if !reflect.DeepEqual(&receivedInfo, expectedInfo) { + if !receivedInfo.Eq(expectedInfo) { t.Errorf("received wrong data: %#v", receivedInfo) } } @@ -240,7 +240,7 @@ func TestContainerInfoWithUidNamespace(t *testing.T) { if err != nil { t.Fatalf("received invalid json data: %v", err) } - if !reflect.DeepEqual(&receivedInfo, expectedInfo) { + if !receivedInfo.Eq(expectedInfo) { t.Errorf("received wrong data: %#v", receivedInfo) } } @@ -281,7 +281,7 @@ func TestRootInfo(t *testing.T) { if err != nil { t.Fatalf("received invalid json data: %v", err) } - if !reflect.DeepEqual(&receivedInfo, expectedInfo) { + if !receivedInfo.Eq(expectedInfo) { t.Errorf("received wrong data: %#v", receivedInfo) } }