Extend the Use-typeurl.Any patch to metrics_test.go

This commit is contained in:
Dalton Hubble 2022-11-02 11:58:47 -07:00 committed by Maxwell G
parent 6d713f3247
commit c26d201423
1 changed files with 26 additions and 2 deletions

View File

@ -1,4 +1,4 @@
From e947c4035ddc405a5978d3ce829b6e4f40c90ce9 Mon Sep 17 00:00:00 2001
From 3b98ff4a9f28118973917ed46c3eee59688fcc8f Mon Sep 17 00:00:00 2001
From: Kazuyoshi Kato <katokazu@amazon.com>
Date: Tue, 22 Mar 2022 00:40:39 +0000
Subject: [PATCH] Use typeurl.Any instead of github.com/gogo/protobuf/types.Any
@ -26,6 +26,7 @@ Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
metadata/boltutil/helpers.go | 20 +++---
metadata/containers.go | 3 +-
metadata/containers_test.go | 83 ++++++++++++++---------
metrics/cgroups/metrics_test.go | 6 +-
pkg/cri/server/events.go | 3 +-
pkg/cri/server/helpers.go | 5 +-
pkg/cri/server/helpers_test.go | 13 ++++
@ -46,7 +47,7 @@ Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
services/events/service.go | 3 +-
services/tasks/local.go | 5 +-
task.go | 7 +-
38 files changed, 267 insertions(+), 123 deletions(-)
39 files changed, 270 insertions(+), 126 deletions(-)
create mode 100644 protobuf/any.go
create mode 100644 protobuf/any_test.go
@ -800,6 +801,29 @@ index c0192a458..7be6e0f2d 100644
}
func testEnv(t *testing.T) (context.Context, *bolt.DB, func()) {
diff --git a/metrics/cgroups/metrics_test.go b/metrics/cgroups/metrics_test.go
index c71ea60a5..c362ea3b9 100644
--- a/metrics/cgroups/metrics_test.go
+++ b/metrics/cgroups/metrics_test.go
@@ -32,7 +32,7 @@ import (
v2 "github.com/containerd/containerd/metrics/cgroups/v2"
v1types "github.com/containerd/containerd/metrics/types/v1"
v2types "github.com/containerd/containerd/metrics/types/v2"
- "github.com/containerd/typeurl"
+ "github.com/containerd/containerd/protobuf"
"github.com/prometheus/client_golang/prometheus"
metrics "github.com/docker/go-metrics"
@@ -152,7 +152,7 @@ func (t *mockStatT) Namespace() string {
func (t *mockStatT) Stats(context.Context) (*types.Any, error) {
if t.isV1 {
- return typeurl.MarshalAny(&v1types.Metrics{})
+ return protobuf.MarshalAnyToProto(&v1types.Metrics{})
}
- return typeurl.MarshalAny(&v2types.Metrics{})
+ return protobuf.MarshalAnyToProto(&v2types.Metrics{})
}
diff --git a/pkg/cri/server/events.go b/pkg/cri/server/events.go
index c8ffdadbf..fbecb29a0 100644
--- a/pkg/cri/server/events.go