mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 15:05:20 +00:00
Addresses issue #6596.
Removes ForTesting_ReferencesAllowBlankSelfLinks. Fixes controller's persistentvolumes unit tests.
This commit is contained in:
@@ -32,10 +32,6 @@ var (
|
||||
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
|
||||
// object, or an error if the object doesn't follow the conventions
|
||||
// that would allow this.
|
||||
@@ -68,11 +64,7 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
|
||||
if version == "" {
|
||||
selfLink := meta.SelfLink()
|
||||
if selfLink == "" {
|
||||
if ForTesting_ReferencesAllowBlankSelfLinks {
|
||||
version = "testing"
|
||||
} else {
|
||||
return nil, ErrNoSelfLink
|
||||
}
|
||||
return nil, ErrNoSelfLink
|
||||
} else {
|
||||
selfLinkUrl, err := url.Parse(selfLink)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user