19 require_once(dirname(dirname(dirname(dirname(__FILE__)))).
'/cli/tests/test_common.php');
20 require_once (__DIR__ .
"/../../../testing/db/createEmptyTestEnvironment.php");
40 $auth =
"--user fossy --password fossy -c $SYSCONF_DIR";
44 $upload_path =
"upload_path";
45 $command =
"cp2foss $auth ../../../pkgagent/agent_tests/testdata/fossology-1.2.0-1.el5.i386.rpm -f $upload_path -d upload_des -q all -v";
46 $last = exec(
"$command 2>&1", $out, $rtn);
48 $repo_string =
"Uploading to folder: '/$upload_path'";
49 $repo_pos = strpos($out[7], $repo_string);
50 $output_msg_count = count($out);
51 $this->assertGreaterThan(0, $repo_pos);
52 $scheduled_agent_info_1 =
"agent_pkgagent is queued to run on";
53 $scheduled_agent_info_2 =
"agent_nomos is queued to run on";
54 $scheduled_agent_info_3 =
"agent_mimetype is queued to run on";
55 $scheduled_agent_info_4 =
"agent_copyright is queued to run on";
57 $pos = strpos($out[$output_msg_count - 1], $scheduled_agent_info_1);
58 $this->assertEquals(0, $pos);
60 $pos = strpos($out[$output_msg_count - 2], $scheduled_agent_info_2);
61 $this->assertEquals(0, $pos);
63 $pos = strpos($out[$output_msg_count - 3], $scheduled_agent_info_3);
64 $this->assertEquals(0, $pos);
66 $pos = strpos($out[$output_msg_count - 4], $scheduled_agent_info_4);
67 $this->assertEquals(0, $pos);
70 if ($out && $out[11]) {
71 $upload_id = get_upload_id($out[11]);
73 $this->assertFalse(
true);
76 $agent_status = check_agent_status(
"ununpack", $upload_id);
77 $this->assertEquals(1, $agent_status);
79 $agent_status = check_agent_status(
"copyright", $upload_id);
80 $this->assertEquals(1, $agent_status);
82 $agent_status = check_agent_status(
"nomos", $upload_id);
83 $this->assertEquals(1, $agent_status);
85 $agent_status = check_agent_status(
"mimetype", $upload_id);
86 $this->assertEquals(1, $agent_status);
88 $agent_status = check_agent_status(
"pkgagent", $upload_id);
89 $this->assertEquals(1, $agent_status);
93 protected function setUp() {
100 list($test_name, $SYSCONF_DIR, $DB_NAME, $PG_CONN) = setupTestEnv($cwd,
"delagent",
false);
102 $REPO_NAME =
"testDbRepo".$test_name;
105 scheduler_operation();
122 $sql =
"SELECT upload_pk, upload_filename FROM upload ORDER BY upload_pk;";
123 $result = pg_query($PG_CONN, $sql);
124 if (pg_num_rows($result) > 0){
125 $row = pg_fetch_assoc($result);
126 $expected = $row[
"upload_pk"] .
" :: ". $row[
"upload_filename"];
128 pg_free_result($result);
130 $command =
"$EXE_PATH -u -n fossy -p fossy";
131 exec($command, $out, $rtn);
133 $this->assertStringStartsWith($expected, $out[1]);
150 $sql =
"SELECT upload_pk, upload_filename FROM upload ORDER BY upload_pk;";
151 $result = pg_query($PG_CONN, $sql);
152 if (pg_num_rows($result) > 0){
153 $row = pg_fetch_assoc($result);
154 $expected = $row[
"upload_pk"] .
" :: ". $row[
"upload_filename"];
156 pg_free_result($result);
158 $command =
"$EXE_PATH -u -n testuser -p testuser";
159 exec($command, $out, $rtn);
161 $this->assertStringStartsWith($expected, $out[1]);
170 print
"End up functional test for cp2foss \n";
test_delagentu()
test delagent -u
add_user($User, $Desc, $Seed, $Hash, $Perm, $Email, $Email_notify, $agentList, $Folder, $default_bucketpool_fk='')
Add a user.
test_delagentu_wronguser()
test delagent -u with wrong user
list_t type structure used to keep various lists. (e.g. there are multiple lists).
upload_testdata()
upload testdata prepare testdata for delagent, upload one tar file and schedule all agents ...