Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
df265b2d
Commit
df265b2d
authored
Oct 27, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15510 from aveshagarwal/master-selflink-objref
Auto commit by PR queue bot
parents
0ced872a
8e4a8b72
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
6 additions
and
25 deletions
+6
-25
ref.go
pkg/api/ref.go
+1
-9
controller_test.go
pkg/controller/daemon/controller_test.go
+0
-4
persistentvolume_claim_binder_controller_test.go
...ntvolume/persistentvolume_claim_binder_controller_test.go
+5
-2
replication_controller_test.go
pkg/controller/replication/replication_controller_test.go
+0
-4
describe_test.go
pkg/kubectl/describe_test.go
+0
-4
manager_test.go
pkg/kubelet/dockertools/manager_test.go
+0
-1
kubelet_test.go
pkg/kubelet/kubelet_test.go
+0
-1
No files found.
pkg/api/ref.go
View file @
df265b2d
...
@@ -32,10 +32,6 @@ var (
...
@@ -32,10 +32,6 @@ var (
ErrNoSelfLink
=
errors
.
New
(
"selfLink was empty, can't make reference"
)
ErrNoSelfLink
=
errors
.
New
(
"selfLink was empty, can't make reference"
)
)
)
// ForTesting_ReferencesAllowBlankSelfLinks can be set to true in tests to avoid
// "ErrNoSelfLink" errors.
var
ForTesting_ReferencesAllowBlankSelfLinks
=
false
// GetReference returns an ObjectReference which refers to the given
// GetReference returns an ObjectReference which refers to the given
// object, or an error if the object doesn't follow the conventions
// object, or an error if the object doesn't follow the conventions
// that would allow this.
// that would allow this.
...
@@ -68,11 +64,7 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
...
@@ -68,11 +64,7 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
if
version
==
""
{
if
version
==
""
{
selfLink
:=
meta
.
SelfLink
()
selfLink
:=
meta
.
SelfLink
()
if
selfLink
==
""
{
if
selfLink
==
""
{
if
ForTesting_ReferencesAllowBlankSelfLinks
{
return
nil
,
ErrNoSelfLink
version
=
"testing"
}
else
{
return
nil
,
ErrNoSelfLink
}
}
else
{
}
else
{
selfLinkUrl
,
err
:=
url
.
Parse
(
selfLink
)
selfLinkUrl
,
err
:=
url
.
Parse
(
selfLink
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/controller/daemon/controller_test.go
View file @
df265b2d
...
@@ -38,10 +38,6 @@ var (
...
@@ -38,10 +38,6 @@ var (
alwaysReady
=
func
()
bool
{
return
true
}
alwaysReady
=
func
()
bool
{
return
true
}
)
)
func
init
()
{
api
.
ForTesting_ReferencesAllowBlankSelfLinks
=
true
}
func
getKey
(
ds
*
extensions
.
DaemonSet
,
t
*
testing
.
T
)
string
{
func
getKey
(
ds
*
extensions
.
DaemonSet
,
t
*
testing
.
T
)
string
{
if
key
,
err
:=
controller
.
KeyFunc
(
ds
);
err
!=
nil
{
if
key
,
err
:=
controller
.
KeyFunc
(
ds
);
err
!=
nil
{
t
.
Errorf
(
"Unexpected error getting key for ds %v: %v"
,
ds
.
Name
,
err
)
t
.
Errorf
(
"Unexpected error getting key for ds %v: %v"
,
ds
.
Name
,
err
)
...
...
pkg/controller/persistentvolume/persistentvolume_claim_binder_controller_test.go
View file @
df265b2d
...
@@ -24,6 +24,7 @@ import (
...
@@ -24,6 +24,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/host_path"
"k8s.io/kubernetes/pkg/volume/host_path"
...
@@ -169,7 +170,6 @@ func TestExampleObjects(t *testing.T) {
...
@@ -169,7 +170,6 @@ func TestExampleObjects(t *testing.T) {
}
}
func
TestBindingWithExamples
(
t
*
testing
.
T
)
{
func
TestBindingWithExamples
(
t
*
testing
.
T
)
{
api
.
ForTesting_ReferencesAllowBlankSelfLinks
=
true
o
:=
testclient
.
NewObjects
(
api
.
Scheme
,
api
.
Scheme
)
o
:=
testclient
.
NewObjects
(
api
.
Scheme
,
api
.
Scheme
)
if
err
:=
testclient
.
AddObjectsFromPath
(
"../../../docs/user-guide/persistent-volumes/claims/claim-01.yaml"
,
o
,
api
.
Scheme
);
err
!=
nil
{
if
err
:=
testclient
.
AddObjectsFromPath
(
"../../../docs/user-guide/persistent-volumes/claims/claim-01.yaml"
,
o
,
api
.
Scheme
);
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -186,11 +186,13 @@ func TestBindingWithExamples(t *testing.T) {
...
@@ -186,11 +186,13 @@ func TestBindingWithExamples(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error getting PV from client: %v"
,
err
)
t
.
Errorf
(
"Unexpected error getting PV from client: %v"
,
err
)
}
}
pv
.
ObjectMeta
.
SelfLink
=
testapi
.
Default
.
SelfLink
(
"pv"
,
""
)
claim
,
error
:=
client
.
PersistentVolumeClaims
(
"ns"
)
.
Get
(
"any"
)
claim
,
error
:=
client
.
PersistentVolumeClaims
(
"ns"
)
.
Get
(
"any"
)
if
error
!=
nil
{
if
error
!=
nil
{
t
.
Errorf
(
"Unexpected error getting PVC from client: %v"
,
err
)
t
.
Errorf
(
"Unexpected error getting PVC from client: %v"
,
err
)
}
}
claim
.
ObjectMeta
.
SelfLink
=
testapi
.
Default
.
SelfLink
(
"pvc"
,
""
)
volumeIndex
:=
NewPersistentVolumeOrderedIndex
()
volumeIndex
:=
NewPersistentVolumeOrderedIndex
()
mockClient
:=
&
mockBinderClient
{
mockClient
:=
&
mockBinderClient
{
...
@@ -273,7 +275,6 @@ func TestBindingWithExamples(t *testing.T) {
...
@@ -273,7 +275,6 @@ func TestBindingWithExamples(t *testing.T) {
}
}
func
TestMissingFromIndex
(
t
*
testing
.
T
)
{
func
TestMissingFromIndex
(
t
*
testing
.
T
)
{
api
.
ForTesting_ReferencesAllowBlankSelfLinks
=
true
o
:=
testclient
.
NewObjects
(
api
.
Scheme
,
api
.
Scheme
)
o
:=
testclient
.
NewObjects
(
api
.
Scheme
,
api
.
Scheme
)
if
err
:=
testclient
.
AddObjectsFromPath
(
"../../../docs/user-guide/persistent-volumes/claims/claim-01.yaml"
,
o
,
api
.
Scheme
);
err
!=
nil
{
if
err
:=
testclient
.
AddObjectsFromPath
(
"../../../docs/user-guide/persistent-volumes/claims/claim-01.yaml"
,
o
,
api
.
Scheme
);
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -289,11 +290,13 @@ func TestMissingFromIndex(t *testing.T) {
...
@@ -289,11 +290,13 @@ func TestMissingFromIndex(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error getting PV from client: %v"
,
err
)
t
.
Errorf
(
"Unexpected error getting PV from client: %v"
,
err
)
}
}
pv
.
ObjectMeta
.
SelfLink
=
testapi
.
Default
.
SelfLink
(
"pv"
,
""
)
claim
,
error
:=
client
.
PersistentVolumeClaims
(
"ns"
)
.
Get
(
"any"
)
claim
,
error
:=
client
.
PersistentVolumeClaims
(
"ns"
)
.
Get
(
"any"
)
if
error
!=
nil
{
if
error
!=
nil
{
t
.
Errorf
(
"Unexpected error getting PVC from client: %v"
,
err
)
t
.
Errorf
(
"Unexpected error getting PVC from client: %v"
,
err
)
}
}
claim
.
ObjectMeta
.
SelfLink
=
testapi
.
Default
.
SelfLink
(
"pvc"
,
""
)
volumeIndex
:=
NewPersistentVolumeOrderedIndex
()
volumeIndex
:=
NewPersistentVolumeOrderedIndex
()
mockClient
:=
&
mockBinderClient
{
mockClient
:=
&
mockBinderClient
{
...
...
pkg/controller/replication/replication_controller_test.go
View file @
df265b2d
...
@@ -39,10 +39,6 @@ import (
...
@@ -39,10 +39,6 @@ import (
var
alwaysReady
=
func
()
bool
{
return
true
}
var
alwaysReady
=
func
()
bool
{
return
true
}
func
init
()
{
api
.
ForTesting_ReferencesAllowBlankSelfLinks
=
true
}
func
getKey
(
rc
*
api
.
ReplicationController
,
t
*
testing
.
T
)
string
{
func
getKey
(
rc
*
api
.
ReplicationController
,
t
*
testing
.
T
)
string
{
if
key
,
err
:=
controller
.
KeyFunc
(
rc
);
err
!=
nil
{
if
key
,
err
:=
controller
.
KeyFunc
(
rc
);
err
!=
nil
{
t
.
Errorf
(
"Unexpected error getting key for rc %v: %v"
,
rc
.
Name
,
err
)
t
.
Errorf
(
"Unexpected error getting key for rc %v: %v"
,
rc
.
Name
,
err
)
...
...
pkg/kubectl/describe_test.go
View file @
df265b2d
...
@@ -39,10 +39,6 @@ type describeClient struct {
...
@@ -39,10 +39,6 @@ type describeClient struct {
client
.
Interface
client
.
Interface
}
}
func
init
()
{
api
.
ForTesting_ReferencesAllowBlankSelfLinks
=
true
}
func
TestDescribePod
(
t
*
testing
.
T
)
{
func
TestDescribePod
(
t
*
testing
.
T
)
{
fake
:=
testclient
.
NewSimpleFake
(
&
api
.
Pod
{
fake
:=
testclient
.
NewSimpleFake
(
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
...
...
pkg/kubelet/dockertools/manager_test.go
View file @
df265b2d
...
@@ -972,7 +972,6 @@ func TestSyncPodsDoesNothing(t *testing.T) {
...
@@ -972,7 +972,6 @@ func TestSyncPodsDoesNothing(t *testing.T) {
}
}
func
TestSyncPodWithPullPolicy
(
t
*
testing
.
T
)
{
func
TestSyncPodWithPullPolicy
(
t
*
testing
.
T
)
{
api
.
ForTesting_ReferencesAllowBlankSelfLinks
=
true
dm
,
fakeDocker
:=
newTestDockerManager
()
dm
,
fakeDocker
:=
newTestDockerManager
()
puller
:=
dm
.
dockerPuller
.
(
*
FakeDockerPuller
)
puller
:=
dm
.
dockerPuller
.
(
*
FakeDockerPuller
)
puller
.
HasImages
=
[]
string
{
"existing_one"
,
"want:latest"
}
puller
.
HasImages
=
[]
string
{
"existing_one"
,
"want:latest"
}
...
...
pkg/kubelet/kubelet_test.go
View file @
df265b2d
...
@@ -61,7 +61,6 @@ import (
...
@@ -61,7 +61,6 @@ import (
)
)
func
init
()
{
func
init
()
{
api
.
ForTesting_ReferencesAllowBlankSelfLinks
=
true
util
.
ReallyCrash
=
true
util
.
ReallyCrash
=
true
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment