aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes/metrics_test.go
diff options
context:
space:
mode:
authorGravatar Yong Tang <yong.tang.github@outlook.com> 2020-03-30 11:10:41 -0700
committerGravatar GitHub <noreply@github.com> 2020-03-30 11:10:41 -0700
commitebbfffaf9df7bdf3bab39c587441e9460aa4f9ef (patch)
tree7cee159d9c690122b02554c2eb8d5038099dacd5 /plugin/kubernetes/metrics_test.go
parent8bbfa19223e7585084acfee58bf7a611ecb4a3d3 (diff)
downloadcoredns-ebbfffaf9df7bdf3bab39c587441e9460aa4f9ef.tar.gz
coredns-ebbfffaf9df7bdf3bab39c587441e9460aa4f9ef.tar.zst
coredns-ebbfffaf9df7bdf3bab39c587441e9460aa4f9ef.zip
Update k8s.io/[api|apimachinery|client-go] to v0.18.0 (#3796)
* Update k8s.io/[api|apimachinery|client-go] to v0.18.0 This PR updates k8s.io/[api|apimachinery|client-go] to v0.18.0 This PR closes 3791 This PR closes 3792 This PR closes 3793 Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix test failures Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix failed tests Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix test failure Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'plugin/kubernetes/metrics_test.go')
-rw-r--r--plugin/kubernetes/metrics_test.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/plugin/kubernetes/metrics_test.go b/plugin/kubernetes/metrics_test.go
index 96039c62f..e1be40d4e 100644
--- a/plugin/kubernetes/metrics_test.go
+++ b/plugin/kubernetes/metrics_test.go
@@ -1,6 +1,7 @@
package kubernetes
import (
+ "context"
"strings"
"testing"
"time"
@@ -22,7 +23,8 @@ const (
func TestDnsProgrammingLatency(t *testing.T) {
client := fake.NewSimpleClientset()
now := time.Now()
- controller := newdnsController(client, dnsControlOpts{
+ ctx := context.TODO()
+ controller := newdnsController(ctx, client, dnsControlOpts{
initEndpointsCache: true,
// This is needed as otherwise the fake k8s client doesn't work properly.
skipAPIObjectsCleanup: true,
@@ -104,24 +106,27 @@ func buildEndpoints(name string, lastChangeTriggerTime interface{}, subsets []ap
}
func createEndpoints(t *testing.T, client kubernetes.Interface, name string, triggerTime interface{}, subsets []api.EndpointSubset) {
- _, err := client.CoreV1().Endpoints(namespace).Create(buildEndpoints(name, triggerTime, subsets))
+ ctx := context.TODO()
+ _, err := client.CoreV1().Endpoints(namespace).Create(ctx, buildEndpoints(name, triggerTime, subsets), meta.CreateOptions{})
if err != nil {
t.Fatal(err)
}
}
func updateEndpoints(t *testing.T, client kubernetes.Interface, name string, triggerTime interface{}, subsets []api.EndpointSubset) {
- _, err := client.CoreV1().Endpoints(namespace).Update(buildEndpoints(name, triggerTime, subsets))
+ ctx := context.TODO()
+ _, err := client.CoreV1().Endpoints(namespace).Update(ctx, buildEndpoints(name, triggerTime, subsets), meta.UpdateOptions{})
if err != nil {
t.Fatal(err)
}
}
func createService(t *testing.T, client kubernetes.Interface, controller dnsController, name string, clusterIp string) {
- if _, err := client.CoreV1().Services(namespace).Create(&api.Service{
+ ctx := context.TODO()
+ if _, err := client.CoreV1().Services(namespace).Create(ctx, &api.Service{
ObjectMeta: meta.ObjectMeta{Namespace: namespace, Name: name},
Spec: api.ServiceSpec{ClusterIP: clusterIp},
- }); err != nil {
+ }, meta.CreateOptions{}); err != nil {
t.Fatal(err)
}
if err := wait.PollImmediate(10*time.Millisecond, 10*time.Second, func() (bool, error) {