@@ -500,26 +500,19 @@ def test_k8s_update_preserves_deploy_options():
500500 options merge entirely in the JSON path.
501501 3. Run `app_api:app:update`.
502502 4. Assert the env vars declared in info.xml are present on the new
503- Deployment pod spec — TEST_ENV_1 with its default and TEST_ENV_2
503+ Deployment pod spec: TEST_ENV_1 with its default and TEST_ENV_2
504504 with the user-provided value.
505505 """
506506 print (" test_k8s_update_preserves_deploy_options..." , end = " " , flush = True )
507507
508- seed_code = (
509- 'require "lib/base.php";'
510- 'OCP\\ Server::get(OCP\\ App\\ IAppManager::class)->loadApp("app_api");'
511- '$svc = OCP\\ Server::get(OCA\\ AppAPI\\ Service\\ ExAppDeployOptionsService::class);'
512- '$svc->addExAppDeployOptions("app-skeleton-python", ['
513- '"environment_variables" => ["TEST_ENV_2" => ["name" => "TEST_ENV_2", "value" => "user_provided_value"]],'
514- '"mounts" => [],'
515- ']);'
516- '$svc->addExAppDeployOptions("zz_fake_second_app", ['
517- '"environment_variables" => ["UNRELATED_VAR" => ["name" => "UNRELATED_VAR", "value" => "x"]],'
518- '"mounts" => [],'
519- ']);'
520- )
521- r = run (["php" , "-r" , seed_code ], stdout = PIPE , stderr = PIPE )
522- assert r .returncode == 0 , f"Seed failed: { r .stderr .decode ()} "
508+ helper = os .path .join (os .path .dirname (os .path .abspath (__file__ )), "integration_helper.php" )
509+
510+ def seed (appid , name , value ):
511+ r = run (["php" , helper , "set-env" , appid , name , value ], stdout = PIPE , stderr = PIPE )
512+ assert r .returncode == 0 , f"seed { appid } /{ name } failed: { r .stderr .decode ()} "
513+
514+ seed ("app-skeleton-python" , "TEST_ENV_2" , "user_provided_value" )
515+ seed ("zz_fake_second_app" , "UNRELATED_VAR" , "x" )
523516
524517 xml = urllib .request .urlopen (SKELETON_XML_URL , timeout = 30 ).read ().decode ()
525518 xml_v2 = re .sub (r"<version>[^<]+</version>" , "<version>100.0.0</version>" , xml , count = 1 )
@@ -558,13 +551,7 @@ def test_k8s_update_preserves_deploy_options():
558551 f"#808 regression: user-provided TEST_ENV_2 lost after update; env_map={ env_map } "
559552 )
560553
561- cleanup_code = (
562- 'require "lib/base.php";'
563- 'OCP\\ Server::get(OCP\\ App\\ IAppManager::class)->loadApp("app_api");'
564- '$svc = OCP\\ Server::get(OCA\\ AppAPI\\ Service\\ ExAppDeployOptionsService::class);'
565- '$svc->removeExAppDeployOptions("zz_fake_second_app");'
566- )
567- run (["php" , "-r" , cleanup_code ], stdout = PIPE , stderr = PIPE )
554+ run (["php" , helper , "remove" , "zz_fake_second_app" ], stdout = PIPE , stderr = PIPE )
568555
569556 print ("OK" )
570557
0 commit comments