// SetTestOnlyCBORClientFeatureGatesForTest overrides the CBOR client feature gates in the test-only // client feature gate instance for the duration of a test. The CBOR client feature gates are // temporarily registered in their own feature gate instance that does not include runtime wiring to // command-line flags or environment variables in order to mitigate the risk of enabling a new // encoding before all integration tests have been demonstrated to pass. // // This will be removed as an alpha requirement. The client feature gates will be registered with // the existing feature gate instance and tests will use // k8s.io/client-go/features/testing.SetFeatureDuringTest (which unlike // k8s.io/component-base/featuregate/testing.SetFeatureGateDuringTest does not accept a feature gate // instance as a parameter). func SetTestOnlyCBORClientFeatureGatesForTest(tb testing.TB, allowed, preferred bool) { … } // EnableCBORForTest patches global state to enable the CBOR serializer and reverses those changes // at the end of the test. As a risk mitigation, integration tests are initially written this way so // that integration tests can be implemented fully and incrementally before exposing options // (including feature gates) that can enable CBOR at runtime. After integration test coverage is // complete, feature gates will be introduced to completely supersede this mechanism. func EnableCBORServingAndStorageForTest(tb testing.TB) { … } // AssertRequestResponseAsCBOR returns a transport.WrapperFunc that will report a test error if a // non-empty request or response body contains data that does not appear to be CBOR-encoded. func AssertRequestResponseAsCBOR(t testing.TB) transport.WrapperFunc { … } type roundTripperFunc … func (f roundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) { … }