Auto-update dependencies (#87)

Produced via:
  `dep ensure -update knative.dev/test-infra knative.dev/pkg`
/assign mattmoor
This commit is contained in:
mattmoor-sockpuppet 2019-09-02 07:18:59 -07:00 committed by Knative Prow Robot
parent 14c30e6f2e
commit ba3627dfdd
6 changed files with 111 additions and 6 deletions

4
Gopkg.lock generated
View File

@ -927,7 +927,7 @@
[[projects]]
branch = "master"
digest = "1:4dbfbd630beb854049c6d436ef47e1e6f07abb75cf66b130cc44dc4a7ce45078"
digest = "1:999e5842e5917fc452ae40769030dbc049e9def569118d01804f0fc46956e4fa"
name = "knative.dev/pkg"
packages = [
"apis",
@ -946,7 +946,7 @@
"metrics/metricskey",
]
pruneopts = "T"
revision = "ec2f20ae67fbbccfac425061f2c7c089d1932105"
revision = "8cae700d29e47d30cbc05ffb230a5e8d73aaec9e"
[[projects]]
branch = "master"

1
vendor/knative.dev/pkg/Gopkg.lock generated vendored
View File

@ -1354,6 +1354,7 @@
"k8s.io/client-go/informers/autoscaling/v1",
"k8s.io/client-go/informers/autoscaling/v2beta1",
"k8s.io/client-go/informers/batch/v1",
"k8s.io/client-go/informers/batch/v1beta1",
"k8s.io/client-go/informers/core/v1",
"k8s.io/client-go/informers/rbac/v1",
"k8s.io/client-go/kubernetes",

View File

@ -26,13 +26,16 @@ aliases:
- dprotaso
controller-approvers:
- mattmoor
- dgerd
- grantr
- mattmoor
- tcnghia
- vagababov
kmeta-approvers:
- mattmoor
- jonjohnsonjr
- dgerd
- vagababov
logging-approvers:
- mdemirhan

View File

@ -0,0 +1,52 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cronjob
import (
"context"
batchv1beta1 "k8s.io/client-go/informers/batch/v1beta1"
"knative.dev/pkg/controller"
"knative.dev/pkg/injection"
"knative.dev/pkg/injection/informers/kubeinformers/factory"
"knative.dev/pkg/logging"
)
func init() {
injection.Default.RegisterInformer(withInformer)
}
// Key is used as the key for associating information
// with a context.Context.
type Key struct{}
func withInformer(ctx context.Context) (context.Context, controller.Informer) {
f := factory.Get(ctx)
inf := f.Batch().V1beta1().CronJobs()
return context.WithValue(ctx, Key{}, inf), inf.Informer()
}
// Get extracts the Kubernetes Job informer from the context.
func Get(ctx context.Context) batchv1beta1.CronJobInformer {
untyped := ctx.Value(Key{})
if untyped == nil {
logging.FromContext(ctx).Panicf(
"Unable to fetch %T from context.", (batchv1beta1.CronJobInformer)(nil))
}
return untyped.(batchv1beta1.CronJobInformer)
}

View File

@ -0,0 +1,38 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
"context"
"knative.dev/pkg/controller"
"knative.dev/pkg/injection"
"knative.dev/pkg/injection/informers/kubeinformers/batchv1beta1/cronjob"
"knative.dev/pkg/injection/informers/kubeinformers/factory/fake"
)
var Get = cronjob.Get
func init() {
injection.Fake.RegisterInformer(withInformer)
}
func withInformer(ctx context.Context) (context.Context, controller.Informer) {
f := fake.Get(ctx)
inf := f.Batch().V1beta1().CronJobs()
return context.WithValue(ctx, cronjob.Key{}, inf), inf.Informer()
}

View File

@ -25,12 +25,17 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"go.uber.org/zap"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/runtime"
clientgotesting "k8s.io/client-go/testing"
"k8s.io/client-go/tools/cache"
"knative.dev/pkg/controller"
"knative.dev/pkg/kmeta"
"knative.dev/pkg/logging"
"knative.dev/pkg/logging/logkey"
_ "knative.dev/pkg/system/testing" // Setup system.Namespace()
)
@ -107,6 +112,12 @@ func (r *TableRow) Test(t *testing.T, factory Factory) {
ctx := r.Ctx
if ctx == nil {
ctx = context.Background()
} else {
// If we have logger setup on the context, decorate it with the key, so that the logs
// look like in prod.
l := logging.FromContext(ctx)
l = l.With(zap.String(logkey.Key, r.Key))
ctx = logging.WithLogger(ctx, l)
}
// Run the Reconcile we're testing.
@ -122,7 +133,7 @@ func (r *TableRow) Test(t *testing.T, factory Factory) {
}
// Previous state is used to diff resource expected state for update requests that were missed.
objPrevState := map[string]runtime.Object{}
objPrevState := make(map[string]runtime.Object, len(r.Objects))
for _, o := range r.Objects {
objPrevState[objKey(o)] = o
}
@ -341,7 +352,7 @@ func (tt TableTest) Test(t *testing.T, factory Factory) {
t.Helper()
for _, test := range tt {
// Record the original objects in table.
originObjects := []runtime.Object{}
originObjects := make([]runtime.Object, 0, len(test.Objects))
for _, obj := range test.Objects {
originObjects = append(originObjects, obj.DeepCopyObject())
}