8 require_once(dirname(dirname(dirname(dirname(__FILE__)))).
'/cli/tests/test_common.php');
9 require_once (__DIR__ .
"/../../../testing/db/createEmptyTestEnvironment.php");
29 $auth =
"--user fossy --password fossy -c $SYSCONF_DIR";
33 $upload_path =
"upload_path";
34 $command =
"cp2foss $auth ../../../pkgagent/agent_tests/testdata/fossology-1.2.0-1.el5.i386.rpm -f $upload_path -d upload_des -q all -v";
35 $last = exec(
"$command 2>&1", $out, $rtn);
37 $repo_string =
"Uploading to folder: '/$upload_path'";
38 $repo_pos = strpos($out[7], $repo_string);
39 $output_msg_count = count($out);
40 $this->assertGreaterThan(0, $repo_pos);
41 $scheduled_agent_info_1 =
"agent_pkgagent is queued to run on";
42 $scheduled_agent_info_2 =
"agent_nomos is queued to run on";
43 $scheduled_agent_info_3 =
"agent_mimetype is queued to run on";
44 $scheduled_agent_info_4 =
"agent_copyright is queued to run on";
46 $pos = strpos($out[$output_msg_count - 1], $scheduled_agent_info_1);
47 $this->assertEquals(0, $pos);
49 $pos = strpos($out[$output_msg_count - 2], $scheduled_agent_info_2);
50 $this->assertEquals(0, $pos);
52 $pos = strpos($out[$output_msg_count - 3], $scheduled_agent_info_3);
53 $this->assertEquals(0, $pos);
55 $pos = strpos($out[$output_msg_count - 4], $scheduled_agent_info_4);
56 $this->assertEquals(0, $pos);
59 if ($out && $out[11]) {
60 $upload_id = get_upload_id($out[11]);
62 $this->assertFalse(
true);
65 $agent_status = check_agent_status(
"ununpack", $upload_id);
66 $this->assertEquals(1, $agent_status);
68 $agent_status = check_agent_status(
"copyright", $upload_id);
69 $this->assertEquals(1, $agent_status);
71 $agent_status = check_agent_status(
"nomos", $upload_id);
72 $this->assertEquals(1, $agent_status);
74 $agent_status = check_agent_status(
"mimetype", $upload_id);
75 $this->assertEquals(1, $agent_status);
77 $agent_status = check_agent_status(
"pkgagent", $upload_id);
78 $this->assertEquals(1, $agent_status);
82 protected function setUp() : void {
89 list($test_name, $SYSCONF_DIR, $DB_NAME, $PG_CONN) = setupTestEnv($cwd,
"delagent",
false);
91 $REPO_NAME =
"testDbRepo".$test_name;
94 scheduler_operation();
111 $sql =
"SELECT upload_pk, upload_filename FROM upload ORDER BY upload_pk;";
113 if (pg_num_rows($result) > 0){
114 $row = pg_fetch_assoc($result);
115 $expected = $row[
"upload_pk"] .
" :: ". $row[
"upload_filename"];
117 pg_free_result($result);
119 $command =
"$EXE_PATH -u -n fossy -p fossy";
120 exec($command, $out, $rtn);
122 $this->assertStringStartsWith($expected, $out[1]);
139 $sql =
"SELECT upload_pk, upload_filename FROM upload ORDER BY upload_pk;";
141 if (pg_num_rows($result) > 0){
142 $row = pg_fetch_assoc($result);
143 $expected = $row[
"upload_pk"] .
" :: ". $row[
"upload_filename"];
145 pg_free_result($result);
147 $command =
"$EXE_PATH -u -n testuser -p testuser";
148 exec($command, $out, $rtn);
150 $this->assertStringStartsWith($expected, $out[1]);
159 print
"End up functional test for cp2foss \n";
test_delagentu()
test delagent -u
upload_testdata()
upload testdata prepare testdata for delagent, upload one tar file and schedule all agents
test_delagentu_wronguser()
test delagent -u with wrong user
add_user($User, $Desc, $Hash, $Perm, $Email, $Email_notify, $Upload_visibility, $agentList, $Folder, $default_bucketpool_fk='')
Add a user.
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
list_t type structure used to keep various lists. (e.g. there are multiple lists).