Skip to content

Commit

Permalink
add clock.go in system
Browse files Browse the repository at this point in the history
  • Loading branch information
xu zhao committed Feb 12, 2019
1 parent 768f132 commit 8d0e8d1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
4 changes: 0 additions & 4 deletions contrib/natss/config/provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,9 @@ spec:
serviceAccountName: natss-dispatcher
containers:
- name: dispatcher
<<<<<<< HEAD
image: github.com/knative/eventing/contrib/natss/pkg/dispatcher
=======
image: github.com/knative/eventing/pkg/provisioners/natss/dispatcher
env:
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
>>>>>>> User can specify the namespace in yaml for knative-eventing
6 changes: 1 addition & 5 deletions pkg/provisioners/channel_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,7 @@ func virtualOldServiceLabels(c *eventingv1alpha1.Channel) map[string]string {
// appropriate OwnerReferences on the resource so handleObject can discover the Channel resource
// that 'owns' it. As well as being garbage collected when the Channel is deleted.
func newVirtualService(channel *eventingv1alpha1.Channel, svc *corev1.Service) *istiov1alpha3.VirtualService {
<<<<<<< HEAD
destinationHost := names.ServiceHostName(channelDispatcherServiceName(channel.Spec.Provisioner.Name), system.Namespace)
=======
destinationHost := controller.ServiceHostName(channelDispatcherServiceName(channel.Spec.Provisioner.Name), system.Namespace())
>>>>>>> User can specify the namespace in yaml for knative-eventing
destinationHost := names.ServiceHostName(channelDispatcherServiceName(channel.Spec.Provisioner.Name), system.Namespace())
return &istiov1alpha3.VirtualService{
ObjectMeta: metav1.ObjectMeta{
GenerateName: channelVirtualServiceName(channel.Name),
Expand Down
32 changes: 32 additions & 0 deletions pkg/system/clock.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
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 system

import (
"time"
)

// Mockable interface for time based testing
type Clock interface {
Now() time.Time
}

type RealClock struct{}

func (RealClock) Now() time.Time {
return time.Now()
}

0 comments on commit 8d0e8d1

Please sign in to comment.