mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-03 19:58:17 +00:00
deployment controller: use contextual logging
This commit is contained in:
@@ -27,13 +27,14 @@ import (
|
||||
"time"
|
||||
|
||||
apps "k8s.io/api/apps/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/apiserver/pkg/storage/names"
|
||||
"k8s.io/client-go/informers"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
"k8s.io/klog/v2/ktesting"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
"k8s.io/utils/pointer"
|
||||
)
|
||||
@@ -944,7 +945,8 @@ func TestDeploymentTimedOut(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
nowFn = test.nowFn
|
||||
if got, exp := DeploymentTimedOut(&test.d, &test.d.Status), test.expected; got != exp {
|
||||
_, ctx := ktesting.NewTestContext(t)
|
||||
if got, exp := DeploymentTimedOut(ctx, &test.d, &test.d.Status), test.expected; got != exp {
|
||||
t.Errorf("expected timeout: %t, got: %t", exp, got)
|
||||
}
|
||||
})
|
||||
@@ -1040,11 +1042,13 @@ func TestAnnotationUtils(t *testing.T) {
|
||||
|
||||
//Test Case 1: Check if anotations are copied properly from deployment to RS
|
||||
t.Run("SetNewReplicaSetAnnotations", func(t *testing.T) {
|
||||
_, ctx := ktesting.NewTestContext(t)
|
||||
|
||||
//Try to set the increment revision from 11 through 20
|
||||
for i := 10; i < 20; i++ {
|
||||
|
||||
nextRevision := fmt.Sprintf("%d", i+1)
|
||||
SetNewReplicaSetAnnotations(&tDeployment, &tRS, nextRevision, true, 5)
|
||||
SetNewReplicaSetAnnotations(ctx, &tDeployment, &tRS, nextRevision, true, 5)
|
||||
//Now the ReplicaSets Revision Annotation should be i+1
|
||||
|
||||
if i >= 12 {
|
||||
|
||||
Reference in New Issue
Block a user