diff --git a/CHANGELOG.md b/CHANGELOG.md index b2a51f0d11..db62d905a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ Kubernetes API Version: 1.16.14 Kubernetes API Version: 1.16.14 +**Breaking Change:** +- `kubernetes.config.Configuration()` no longer returns the default configuration. Use `kubernetes.config.Configuration.get_default_copy()` now to get the default configuration. [OpenAPITools/openapi-generator#4485](https://github.com/OpenAPITools/openapi-generator/pull/4485), [OpenAPITools/openapi-generator#5315](https://github.com/OpenAPITools/openapi-generator/pull/5315) + **API Change:** - Resolve regression in metadata.managedFields handling in update/patch requests submitted by older API clients ([#91748](https://github.com/kubernetes/kubernetes/pull/91748), [@apelisse](https://github.com/apelisse)) [SIG API Machinery and Testing] diff --git a/kubernetes/test/test_configuration.py b/kubernetes/test/test_configuration.py new file mode 100644 index 0000000000..15e065090a --- /dev/null +++ b/kubernetes/test/test_configuration.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +import unittest + +from kubernetes.client import Configuration + +class TestConfiguration(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + # reset Configuration + Configuration.set_default(None) + + def testConfiguration(self): + # check that different instances use different dictionaries + c1 = Configuration() + c2 = Configuration() + self.assertNotEqual(id(c1.api_key), id(c2.api_key)) + self.assertNotEqual(id(c1.api_key_prefix), id(c2.api_key_prefix)) + + def testDefaultConfiguration(self): + # prepare default configuration + c1 = Configuration(host="example.com") + c1.debug = True + Configuration.set_default(c1) + + # get default configuration + c2 = Configuration.get_default_copy() + self.assertEqual(c2.host, "example.com") + self.assertTrue(c2.debug) + + self.assertNotEqual(id(c1.api_key), id(c2.api_key)) + self.assertNotEqual(id(c1.api_key_prefix), id(c2.api_key_prefix)) + + +if __name__ == '__main__': + unittest.main()