update dix
This commit is contained in:
parent
e921a49d5b
commit
11691a5876
11 changed files with 1108 additions and 54 deletions
35
Panel/modules/update/tests/update_config_smoke.php
Normal file
35
Panel/modules/update/tests/update_config_smoke.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
$settings = array();
|
||||
require_once(dirname(__DIR__) . '/../administration/panel_update.php');
|
||||
|
||||
function gsp_update_smoke_assert($condition, $message)
|
||||
{
|
||||
if (!$condition) {
|
||||
fwrite(STDERR, "FAIL: {$message}\n");
|
||||
exit(1);
|
||||
}
|
||||
echo "PASS: {$message}\n";
|
||||
}
|
||||
|
||||
$cfg = gsp_update_settings();
|
||||
gsp_update_smoke_assert(function_exists('gsp_do_configured_git_update'), 'configured Git updater helper is top-level');
|
||||
gsp_update_smoke_assert($cfg['repo_url'] === 'http://forge.runlevelsystems.com/dev/GSP.git', 'default repo URL is Forgejo');
|
||||
gsp_update_smoke_assert($cfg['branch'] === 'Panel-unstable', 'default branch is Panel-unstable');
|
||||
gsp_update_smoke_assert($cfg['panel_source_path'] === 'Panel', 'default Panel source folder');
|
||||
gsp_update_smoke_assert($cfg['linux_agent_source_path'] === 'Agent_Linux', 'default Linux agent source folder');
|
||||
gsp_update_smoke_assert($cfg['windows_agent_source_path'] === 'Agent-Windows', 'default Windows agent source folder');
|
||||
gsp_update_smoke_assert($cfg['website_source_path'] === 'Website', 'default Website source folder');
|
||||
gsp_update_smoke_assert(empty(gsp_validate_update_settings($cfg)), 'default update settings validate');
|
||||
|
||||
$bad = $cfg;
|
||||
$bad['branch'] = '../bad';
|
||||
gsp_update_smoke_assert(!empty(gsp_validate_update_settings($bad)), 'invalid branch is rejected');
|
||||
|
||||
$tmp = sys_get_temp_dir() . '/gsp_update_smoke_' . getmypid();
|
||||
@mkdir($tmp . '/Panel', 0777, true);
|
||||
gsp_update_smoke_assert(gsp_component_source_path($tmp, 'Panel') !== false, 'component source path resolves under checkout');
|
||||
gsp_update_smoke_assert(gsp_component_source_path($tmp, '../Panel') === false, 'component source path rejects traversal');
|
||||
@rmdir($tmp . '/Panel');
|
||||
@rmdir($tmp);
|
||||
|
||||
echo "All update config smoke tests passed.\n";
|
||||
Loading…
Add table
Add a link
Reference in a new issue