Skip to content

Commit d085a36

Browse files
authored
Merge pull request #6854 from BOINC/vko_test_proj_init_file
[windows][installer] Add project_init.xml test
2 parents 28dba1e + 47b59bc commit d085a36

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

.github/workflows/windows.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ jobs:
213213
matrix:
214214
type: [install, upgrade_from_alpha, upgrade_from_stable]
215215
platform: [x64, arm64]
216-
installation_type: [normal, service, test_acct_mgr_login, test_client_auth_file]
216+
installation_type: [normal, service, test_acct_mgr_login, test_client_auth_file, test_proj_init_file]
217217
include:
218218
- platform: x64
219219
runner: windows-latest
@@ -239,6 +239,11 @@ jobs:
239239
argument_list_release: "/quiet /qn /norestart /l*v release.log ENABLEPROTECTEDAPPLICATIONEXECUTION3=1"
240240
argument_list_install: "/quiet /qn /norestart /l*v install.log ENABLEPROTECTEDAPPLICATIONEXECUTION3=1 BOINC_PROJECT_USERNAME=test_user BOINC_PROJECT_PASSWORD=qwerty123456!@#$%^"
241241
argument_list_prepare: '--create-user --username test_user --password "qwerty123456!@#$%^"'
242+
- installation_type: test_proj_init_file
243+
argument_list_alpha: "/quiet /qn /l*v alpha.log"
244+
argument_list_release: "/quiet /qn /l*v release.log"
245+
argument_list_install: "/quiet /qn /l*v install.log PROJINIT_URL=https://test.com PROJINIT_NAME=test PROJINIT_AUTH=abcdef1234567890"
246+
argument_list_prepare: ""
242247
fail-fast: false
243248
steps:
244249
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd

tests/windows_installer_integration_tests.py

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def __init__(self, installation_type="normal", test_type="install"):
4545
self.result &= self.test_client_auth_file()
4646
if self.test_type == "install":
4747
self.result &= self.test_boinc_master_user_only_exists()
48+
if self.installation_type == "test_proj_init_file":
49+
self.result &= self.test_proj_init_file()
4850

4951
def _get_test_executable_file_path(self, filename):
5052
return pathlib.Path("C:\\Program Files\\BOINC\\") / filename
@@ -248,13 +250,54 @@ def test_login_token_file(self):
248250

249251
return ts.result()
250252

253+
def test_proj_init_file(self):
254+
ts = testset.TestSet("Test project init file")
255+
project_init_file = self._get_test_data_file_path("project_init.xml")
256+
ts.expect_true(os.path.exists(project_init_file), "Test 'project_init.xml' file exists in 'C:\\ProgramData\\BOINC\\'")
257+
258+
if os.path.exists(project_init_file):
259+
try:
260+
tree = ET.parse(project_init_file)
261+
root = tree.getroot()
262+
263+
ts.expect_equal("project_init", root.tag, "Test root element is 'project_init'")
264+
265+
url_element = root.find("url")
266+
name_element = root.find("name")
267+
account_key_element = root.find("account_key")
268+
embedded_element = root.find("embedded")
269+
270+
ts.expect_true(url_element is not None, "Test 'url' element exists")
271+
ts.expect_true(name_element is not None, "Test 'name' element exists")
272+
ts.expect_true(account_key_element is not None, "Test 'account_key' element exists")
273+
ts.expect_true(embedded_element is not None, "Test 'embedded' element exists")
274+
275+
if url_element is not None:
276+
ts.expect_equal("https://test.com", url_element.text, "Test 'url' element contains 'https://test.com'")
277+
278+
if name_element is not None:
279+
ts.expect_equal("test", name_element.text, "Test 'name' element contains 'test'")
280+
281+
if account_key_element is not None:
282+
ts.expect_equal("abcdef1234567890", account_key_element.text, "Test 'account_key' element contains 'abcdef1234567890'")
283+
284+
if embedded_element is not None:
285+
ts.expect_equal("0", embedded_element.text, "Test 'embedded' element contains '0'")
286+
287+
except ET.ParseError as e:
288+
ts.expect_true(False, f"Test XML file is well-formed (Parse error: {e})")
289+
except Exception as e:
290+
ts.expect_true(False, f"Test XML file can be processed (Error: {e})")
291+
292+
return ts.result()
293+
251294
if __name__ == "__main__":
252295
parser = argparse.ArgumentParser(description="BOINC Windows Installer Integration Tests")
253296
parser.add_argument(
254297
"--installation-type",
255298
type=str,
256299
default="normal",
257-
help="Installation type: 'normal' (default), 'service', 'test_acct_mgr_login', or 'test_client_auth_file'"
300+
help="Installation type: 'normal' (default), 'service', 'test_acct_mgr_login', 'test_client_auth_file', or 'test_proj_init_file'"
258301
)
259302
parser.add_argument(
260303
"--type",

0 commit comments

Comments
 (0)