@@ -65,16 +65,16 @@ def _process_template(self, file):
6565 with open (file ) as file_in , NamedTemporaryFile (mode = 'w+' , suffix = '.yaml' , delete = False ) as out :
6666 template = Template (file_in .read ())
6767 out .write (template .render (name = name ))
68- self .tmp_files .append (out .name )
69- return name , out .name
68+ file_path = out .name
69+ self .tmp_files .append (file_path )
70+ return name , file_path
7071
7172 def test_create_res_comp_for_chart_with_ns (self ):
7273 if not TestKubePlus ._is_kubeplus_running ():
7374 print ("KubePlus is not running. Deploy KubePlus and then run tests" )
7475 sys .exit (0 )
7576
76- _ , file = TestKubePlus ._process_template ("wordpress-service-composition-chart-withns.yaml" )
77- cmd = f"kubectl create -f { file } --kubeconfig=../kubeplus-saas-provider.json"
77+ cmd = "kubectl create -f wordpress-service-composition-chart-withns.yaml --kubeconfig=../kubeplus-saas-provider.json"
7878 out , err = TestKubePlus .run_command (cmd )
7979 # print("Out:" + out)
8080 # print("Err:" + err)
@@ -88,8 +88,7 @@ def test_create_res_comp_for_chart_with_shared_storage(self):
8888 cmd = "kubectl create -f storage-class-fast.yaml"
8989 TestKubePlus .run_command (cmd )
9090
91- _ , file = TestKubePlus ._process_template ("storage-isolation/wordpress-service-composition.yaml" )
92- cmd = f"kubectl create -f { file } --kubeconfig=../kubeplus-saas-provider.json"
91+ cmd = "kubectl create -f storage-isolation/wordpress-service-composition.yaml --kubeconfig=../kubeplus-saas-provider.json"
9392 out , err = TestKubePlus .run_command (cmd )
9493 # print("Out:" + out)
9594 # print("Err:" + err)
@@ -103,8 +102,7 @@ def test_create_res_comp_with_incomplete_resource_quota(self):
103102 print ("KubePlus is not running. Deploy KubePlus and then run tests" )
104103 sys .exit (0 )
105104
106- _ , file = TestKubePlus ._process_template ("resource-quota/wordpress-service-composition-1.yaml" )
107- cmd = f"kubectl create -f { file } --kubeconfig=../kubeplus-saas-provider.json"
105+ cmd = "kubectl create -f resource-quota/wordpress-service-composition-1.yaml --kubeconfig=../kubeplus-saas-provider.json"
108106 out , err = TestKubePlus .run_command (cmd )
109107 # print("Out:" + out)
110108 # print("Err:" + err)
@@ -174,7 +172,6 @@ def test_license_plugin(self):
174172 out , err = TestKubePlus .run_command (cmd )
175173
176174
177- # @unittest.skip("Skipping application update test")
178175 def test_application_update (self ):
179176 if not TestKubePlus ._is_kubeplus_running ():
180177 print ("KubePlus is not running. Deploy KubePlus and then run tests" )
@@ -193,7 +190,7 @@ def test_application_update(self):
193190
194191 cmd = "kubectl upload chart ../examples/multitenancy/hello-world/hello-world-chart-0.0.3.tgz ../kubeplus-saas-provider.json"
195192 out , err = TestKubePlus .run_command (cmd )
196- cmd = f "kubectl create -f ../examples/multitenancy/hello-world/hello-world-service-composition-localchart.yaml --kubeconfig=../kubeplus-saas-provider.json"
193+ cmd = "kubectl create -f ../examples/multitenancy/hello-world/hello-world-service-composition-localchart.yaml --kubeconfig=../kubeplus-saas-provider.json"
197194 out , err = TestKubePlus .run_command (cmd )
198195
199196 crd = "helloworldservices.platformapi.kubeplus"
@@ -313,9 +310,8 @@ def cleanup():
313310 TestKubePlus .run_command (cmd )
314311
315312 # create API
316- _ , file = TestKubePlus ._process_template ("application-upgrade/resource-composition-localchart.yaml" )
317313 namespace , tenant_file = TestKubePlus ._process_template ("application-upgrade/tenant1.yaml" )
318- cmd = f"kubectl create -f { file } --kubeconfig=./application-upgrade/provider.conf"
314+ cmd = f"kubectl create -f application-upgrade/resource-composition-localchart.yaml --kubeconfig=./application-upgrade/provider.conf"
319315 TestKubePlus .run_command (cmd )
320316
321317 # CRDs check
@@ -377,15 +373,15 @@ def cleanup():
377373
378374 # upgrade to version 2
379375 data = None
380- with open (file , 'r' ) as f :
376+ with open ('./application-upgrade/resource-composition-localchart.yaml' , 'r' ) as f :
381377 data = yaml .safe_load (f )
382378
383379 data ['spec' ]['newResource' ]['chartURL' ] = 'file:///resource-composition-0.0.2.tgz'
384380
385- with open (file , 'w' ) as f :
381+ with open ('./application-upgrade/resource-composition-localchart.yaml' , 'w' ) as f :
386382 yaml .safe_dump (data , f , default_flow_style = False )
387383
388- cmd = f 'kubectl apply -f { file } --kubeconfig=./application-upgrade/provider.conf'
384+ cmd = 'kubectl apply -f ./application-upgrade/resource-composition-localchart.yaml --kubeconfig=./application-upgrade/provider.conf'
389385 out , err = TestKubePlus .run_command (cmd )
390386
391387 # sleep to let the pods run
0 commit comments