mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 06:02:18 +00:00
Fixes:
* Fix kubecfg test, which was writing an internal object straight to yaml * Address review comments
This commit is contained in:
@@ -54,8 +54,8 @@ func GetScheme(schemeName string) *Scheme {
|
||||
// from a conversion.Scope.
|
||||
func fromScope(s conversion.Scope) (inVersion, outVersion string, scheme *Scheme) {
|
||||
scheme = DefaultScheme
|
||||
inVersion = s.Meta()["srcVersion"].(string)
|
||||
outVersion = s.Meta()["destVersion"].(string)
|
||||
inVersion = s.Meta().SrcVersion
|
||||
outVersion = s.Meta().DestVersion
|
||||
// If a scheme tag was provided, use it. Look at the struct tag corresponding
|
||||
// to version "".
|
||||
if name := s.SrcTag().Get("scheme"); inVersion == "" && name != "" {
|
||||
|
@@ -52,10 +52,10 @@ func TestScheme(t *testing.T) {
|
||||
// Register functions to verify that scope.Meta() gets set correctly.
|
||||
err := runtime.DefaultScheme.AddConversionFuncs(
|
||||
func(in *InternalSimple, out *ExternalSimple, scope conversion.Scope) error {
|
||||
if e, a := "", scope.Meta()["srcVersion"].(string); e != a {
|
||||
if e, a := "", scope.Meta().SrcVersion; e != a {
|
||||
t.Errorf("Expected '%v', got '%v'", e, a)
|
||||
}
|
||||
if e, a := "externalVersion", scope.Meta()["destVersion"].(string); e != a {
|
||||
if e, a := "externalVersion", scope.Meta().DestVersion; e != a {
|
||||
t.Errorf("Expected '%v', got '%v'", e, a)
|
||||
}
|
||||
scope.Convert(&in.JSONBase, &out.JSONBase, 0)
|
||||
@@ -64,10 +64,10 @@ func TestScheme(t *testing.T) {
|
||||
return nil
|
||||
},
|
||||
func(in *ExternalSimple, out *InternalSimple, scope conversion.Scope) error {
|
||||
if e, a := "externalVersion", scope.Meta()["srcVersion"].(string); e != a {
|
||||
if e, a := "externalVersion", scope.Meta().SrcVersion; e != a {
|
||||
t.Errorf("Expected '%v', got '%v'", e, a)
|
||||
}
|
||||
if e, a := "", scope.Meta()["destVersion"].(string); e != a {
|
||||
if e, a := "", scope.Meta().DestVersion; e != a {
|
||||
t.Errorf("Expected '%v', got '%v'", e, a)
|
||||
}
|
||||
scope.Convert(&in.JSONBase, &out.JSONBase, 0)
|
||||
|
Reference in New Issue
Block a user