@@ -108,6 +108,50 @@ async def example_deployment_spec(ns):
108108 }
109109
110110
111+ @pytest .fixture
112+ async def example_crd_spec ():
113+ spec = {
114+ "apiVersion" : "apiextensions.k8s.io/v1" ,
115+ "kind" : "CustomResourceDefinition" ,
116+ "metadata" : {"name" : "shirts.stable.example.com" },
117+ "spec" : {
118+ "group" : "stable.example.com" ,
119+ "scope" : "Namespaced" ,
120+ "names" : {"plural" : "shirts" , "singular" : "shirt" , "kind" : "Shirt" },
121+ "versions" : [
122+ {
123+ "name" : "v1" ,
124+ "served" : True ,
125+ "storage" : True ,
126+ "schema" : {
127+ "openAPIV3Schema" : {
128+ "type" : "object" ,
129+ "properties" : {
130+ "spec" : {
131+ "type" : "object" ,
132+ "properties" : {
133+ "color" : {"type" : "string" },
134+ "size" : {"type" : "string" },
135+ },
136+ }
137+ },
138+ }
139+ },
140+ "selectableFields" : [
141+ {"jsonPath" : ".spec.color" },
142+ {"jsonPath" : ".spec.size" },
143+ ],
144+ "additionalPrinterColumns" : [
145+ {"jsonPath" : ".spec.color" , "name" : "Color" , "type" : "string" },
146+ {"jsonPath" : ".spec.size" , "name" : "Size" , "type" : "string" },
147+ ],
148+ }
149+ ],
150+ },
151+ }
152+ yield spec
153+
154+
111155def check_socket (host , port ):
112156 with closing (socket .socket (socket .AF_INET , socket .SOCK_STREAM )) as sock :
113157 return sock .connect_ex ((host , port )) == 0
@@ -163,8 +207,9 @@ def serviceaccount(k8s_cluster, k8s_token):
163207 host , port = _hostport .split (":" )
164208
165209 # Create a temporary directory and populate it with the serviceaccount files
166- with tempfile .TemporaryDirectory () as tempdir , set_env (
167- KUBERNETES_SERVICE_HOST = host , KUBERNETES_SERVICE_PORT = port
210+ with (
211+ tempfile .TemporaryDirectory () as tempdir ,
212+ set_env (KUBERNETES_SERVICE_HOST = host , KUBERNETES_SERVICE_PORT = port ),
168213 ):
169214 tempdir = Path (tempdir )
170215 # Create ca.crt in tempdir from the certificate-authority-data in kubeconfig
0 commit comments