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
3693ed09
Commit
3693ed09
authored
May 21, 2018
by
David Eads
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove API dependency on printers
parent
080739a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
11 deletions
+8
-11
BUILD
pkg/api/testing/compat/BUILD
+0
-1
compatibility_tester.go
pkg/api/testing/compat/compatibility_tester.go
+8
-10
No files found.
pkg/api/testing/compat/BUILD
View file @
3693ed09
...
@@ -11,7 +11,6 @@ go_library(
...
@@ -11,7 +11,6 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/api/testing/compat",
importpath = "k8s.io/kubernetes/pkg/api/testing/compat",
deps = [
deps = [
"//pkg/api/legacyscheme:go_default_library",
"//pkg/api/legacyscheme:go_default_library",
"//pkg/printers:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
...
...
pkg/api/testing/compat/compatibility_tester.go
View file @
3693ed09
...
@@ -19,7 +19,6 @@ package compat
...
@@ -19,7 +19,6 @@ package compat
import
(
import
(
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"os"
"reflect"
"reflect"
"regexp"
"regexp"
"strconv"
"strconv"
...
@@ -30,7 +29,6 @@ import (
...
@@ -30,7 +29,6 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/printers"
)
)
// Based on: https://github.com/openshift/origin/blob/master/pkg/api/compatibility_test.go
// Based on: https://github.com/openshift/origin/blob/master/pkg/api/compatibility_test.go
...
@@ -72,14 +70,11 @@ func TestCompatibility(
...
@@ -72,14 +70,11 @@ func TestCompatibility(
t
.
Fatalf
(
"Unexpected error: %v"
,
err
)
t
.
Fatalf
(
"Unexpected error: %v"
,
err
)
}
}
hasError
:=
false
for
k
,
expectedValue
:=
range
expectedKeys
{
for
k
,
expectedValue
:=
range
expectedKeys
{
keys
:=
strings
.
Split
(
k
,
"."
)
keys
:=
strings
.
Split
(
k
,
"."
)
if
actualValue
,
ok
,
err
:=
getJSONValue
(
generic
,
keys
...
);
err
!=
nil
||
!
ok
{
if
actualValue
,
ok
,
err
:=
getJSONValue
(
generic
,
keys
...
);
err
!=
nil
||
!
ok
{
t
.
Errorf
(
"Unexpected error for %s: %v"
,
k
,
err
)
t
.
Errorf
(
"Unexpected error for %s: %v"
,
k
,
err
)
hasError
=
true
}
else
if
!
reflect
.
DeepEqual
(
expectedValue
,
fmt
.
Sprintf
(
"%v"
,
actualValue
))
{
}
else
if
!
reflect
.
DeepEqual
(
expectedValue
,
fmt
.
Sprintf
(
"%v"
,
actualValue
))
{
hasError
=
true
t
.
Errorf
(
"Unexpected value for %v: expected %v, got %v"
,
k
,
expectedValue
,
actualValue
)
t
.
Errorf
(
"Unexpected value for %v: expected %v, got %v"
,
k
,
expectedValue
,
actualValue
)
}
}
}
}
...
@@ -89,14 +84,17 @@ func TestCompatibility(
...
@@ -89,14 +84,17 @@ func TestCompatibility(
actualValue
,
ok
,
err
:=
getJSONValue
(
generic
,
keys
...
)
actualValue
,
ok
,
err
:=
getJSONValue
(
generic
,
keys
...
)
if
err
==
nil
||
ok
{
if
err
==
nil
||
ok
{
t
.
Errorf
(
"Unexpected value found for key %s: %v"
,
absentKey
,
actualValue
)
t
.
Errorf
(
"Unexpected value found for key %s: %v"
,
absentKey
,
actualValue
)
hasError
=
true
}
}
}
}
if
hasError
{
if
t
.
Failed
()
{
printer
:=
&
printers
.
JSONPrinter
{}
data
,
err
:=
json
.
MarshalIndent
(
obj
,
""
,
" "
)
printer
.
PrintObj
(
obj
,
os
.
Stdout
)
if
err
!=
nil
{
t
.
Logf
(
"2: Encoded value: %#v"
,
string
(
output
))
t
.
Log
(
err
)
}
else
{
t
.
Log
(
string
(
data
))
}
t
.
Logf
(
"2: Encoded value: %v"
,
string
(
output
))
}
}
}
}
...
...
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