Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for IsStrictDecodingError (0.26 sec)

  1. staging/src/k8s.io/apimachinery/pkg/runtime/error.go

    		s.WriteString(err.Error())
    	}
    	return s.String()
    }
    
    func (e *strictDecodingError) Errors() []error {
    	return e.errors
    }
    
    // IsStrictDecodingError returns true if the error indicates that the provided object
    // strictness violations.
    func IsStrictDecodingError(err error) bool {
    	if err == nil {
    		return false
    	}
    	_, ok := err.(*strictDecodingError)
    	return ok
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 19 21:24:36 UTC 2021
    - 4.7K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apiserver/pkg/audit/policy/reader.go

    	// Try strict decoding first.
    	_, gvk, err := strictDecoder.Decode(policyDef, nil, policy)
    	if err != nil {
    		if !runtime.IsStrictDecodingError(err) {
    			return nil, fmt.Errorf("failed decoding: %w", err)
    		}
    		var (
    			lenientDecoder = audit.Codecs.UniversalDecoder(apiGroupVersions...)
    			lenientErr     error
    		)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Nov 03 04:09:40 UTC 2022
    - 2.9K bytes
    - Viewed (0)
  3. pkg/kubelet/kubeletconfig/util/codec/codec.go

    		// Try strict decoding first. If that fails decode with a lenient
    		// decoder, which has only v1beta1 registered, and log a warning.
    		// The lenient path is to be dropped when support for v1beta1 is dropped.
    		if !runtime.IsStrictDecodingError(err) {
    			return nil, fmt.Errorf("failed to decode: %w", err)
    		}
    
    		var lenientErr error
    		_, lenientCodecs, lenientErr := codec.NewLenientSchemeAndCodecs(
    			kubeletconfig.AddToScheme,
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 03 21:48:29 UTC 2023
    - 4.2K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apimachinery/pkg/runtime/serializer/recognizer/recognizer.go

    			// error was a strict decoding error (e.g. unknown or
    			// duplicate fields), we still consider the recognizer
    			// to have understood the object
    			if out == nil || !runtime.IsStrictDecodingError(err) {
    				lastErr = err
    				continue
    			}
    		}
    		return out, actual, err
    	}
    
    	if lastErr == nil {
    		lastErr = fmt.Errorf("no serialization format matched the provided data")
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 19 21:24:36 UTC 2021
    - 3.5K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apimachinery/pkg/runtime/serializer/codec_test.go

    	strictCodec := newCodecFactory(s, newSerializersForScheme(s, testMetaFactory{}, CodecFactoryOptions{Pretty: true, Strict: true})).LegacyCodec()
    	_, _, err := strictCodec.Decode([]byte(duplicateKeys), nil, nil)
    	if !runtime.IsStrictDecodingError(err) {
    		t.Fatalf("StrictDecodingError not returned on object with duplicate keys: %v, type: %v", err, reflect.TypeOf(err))
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 12 15:46:12 UTC 2023
    - 13.2K bytes
    - Viewed (0)
  6. pkg/kubelet/kubeletconfig/configfiles/configfiles_test.go

    				}
    			}
    			loader, err := NewFsLoader(fs, path)
    			if err != nil {
    				t.Fatalf("unexpected error: %v", err)
    			}
    			kc, err := loader.Load()
    
    			if c.strictErr && !runtime.IsStrictDecodingError(errors.Unwrap(err)) {
    				t.Fatalf("got error: %v, want strict decoding error", err)
    			}
    			if utiltest.SkipRest(t, c.desc, err, c.err) {
    				return
    			}
    			if !apiequality.Semantic.DeepEqual(c.expect, kc) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 18 12:18:41 UTC 2023
    - 7.2K bytes
    - Viewed (0)
  7. cmd/kube-scheduler/app/options/options_test.go

    			},
    			expectedError: `unknown field "foo"`,
    			checkErrFn:    runtime.IsStrictDecodingError,
    		},
    		{
    			name: "duplicate fields",
    			options: &Options{
    				ConfigFile: duplicateFieldConfig,
    				Logs:       logs.NewOptions(),
    			},
    			expectedError: `key "leaderElect" already set`,
    			checkErrFn:    runtime.IsStrictDecodingError,
    		},
    		{
    			name: "high throughput profile",
    			options: &Options{
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Sep 13 07:42:19 UTC 2023
    - 30.3K bytes
    - Viewed (0)
  8. cmd/kube-proxy/app/server_test.go

    			{
    				name:    "Duplicate fields",
    				config:  fmt.Sprintf("%s\nbindAddress: 1.2.3.4", yamlTemplate),
    				checkFn: kuberuntime.IsStrictDecodingError,
    			},
    			{
    				name:    "Unknown field",
    				config:  fmt.Sprintf("%s\nfoo: bar", yamlTemplate),
    				checkFn: kuberuntime.IsStrictDecodingError,
    			},
    		*/
    	}
    
    	version := "apiVersion: kubeproxy.config.k8s.io/v1alpha1"
    	for _, tc := range testCases {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 22 05:08:41 UTC 2024
    - 32.3K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apimachinery/pkg/runtime/serializer/cbor/cbor_test.go

    			expectedObj: &metav1.PartialObjectMetadata{},
    			expectedGVK: &schema.GroupVersionKind{Group: "x", Version: "y", Kind: "z"},
    			assertOnError: func(t *testing.T, err error) {
    				if !runtime.IsStrictDecodingError(err) {
    					t.Errorf("expected StrictDecodingError, got: %v", err)
    				}
    			},
    		},
    		{
    			name:        "no strict mode no strict error",
    			data:        []byte{0xa1, 0x61, 'z', 0x01}, // {'z': 1}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 13 14:57:12 UTC 2024
    - 20.1K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apimachinery/pkg/runtime/serializer/json/json_test.go

    			t.Errorf("%d: failed: %v", i, err)
    			continue
    		case err != nil:
    			if !test.errFn(err) {
    				logTestCase(t, test)
    				t.Errorf("%d: failed: %v", i, err)
    			}
    			if !runtime.IsStrictDecodingError(err) && obj != nil {
    				logTestCase(t, test)
    				t.Errorf("%d: should have returned nil object", i)
    			}
    			continue
    		}
    
    		if test.into != nil && test.into != obj {
    			logTestCase(t, test)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Apr 04 15:55:02 UTC 2024
    - 40K bytes
    - Viewed (0)
Back to top