From Fedora Project Wiki

Line 17: Line 17:
 
<code>start_job ([testplan_url]) -> job_id </code>
 
<code>start_job ([testplan_url]) -> job_id </code>
  
'''Params'''
+
''Params''
 
* <code>testplan_url</code> ~ link to wiki page with metadata (usefull for frontends)
 
* <code>testplan_url</code> ~ link to wiki page with metadata (usefull for frontends)
'''Returns'''
+
''Returns''
 
* <code>job_id</code> ~ job identifier for Job <-> Testrun relationship.
 
* <code>job_id</code> ~ job identifier for Job <-> Testrun relationship.
  
Line 29: Line 29:
 
<code>start_testrun (test_url, [job_id]) -> testrun_id</code>
 
<code>start_testrun (test_url, [job_id]) -> testrun_id</code>
  
'''Params'''
+
''Params''
 
* <code>test_url</code> ~ link to wiki page with metadata (usefull for frontends)
 
* <code>test_url</code> ~ link to wiki page with metadata (usefull for frontends)
 
* <code>job_id</code> ~ optional argument. If set, new record will be created in the Job <-> Testrun relationship table.
 
* <code>job_id</code> ~ optional argument. If set, new record will be created in the Job <-> Testrun relationship table.
'''Returns'''
+
''Returns''
 
* <code>testrun_id</code> ~ identifier of the record inside Testrun table.
 
* <code>testrun_id</code> ~ identifier of the record inside Testrun table.
  
Line 42: Line 42:
 
<code>end_testrun (testrun_id, result, log_url, [keyval_pairs, summary, highlights, score])</code>
 
<code>end_testrun (testrun_id, result, log_url, [keyval_pairs, summary, highlights, score])</code>
  
'''Params'''
+
''Params''
 
* <code>testrun_id</code> ~ Testrun identifier (see [[#start_testrun]]
 
* <code>testrun_id</code> ~ Testrun identifier (see [[#start_testrun]]
 
* <code>result</code> ~ PASSED, FAILED, INFO, ... (see <<Result>> at [[AutoQA_resultsdb_schema#Result|ResultsDB schema]])
 
* <code>result</code> ~ PASSED, FAILED, INFO, ... (see <<Result>> at [[AutoQA_resultsdb_schema#Result|ResultsDB schema]])
 
* <code>log_url</code> ~ URL pointing to logs etc. (most probably in the Autotest storage)
 
* <code>log_url</code> ~ URL pointing to logs etc. (most probably in the Autotest storage)
* <code>keyval_pairs</code> ~ Dictionary of key-value pairs, which will be stored in the TestrunData table. If value is array, then multiple lines are created.
+
* <code>keyval_pairs</code> ~ Dictionary (JSON?) of key-value pairs to be stored (see [[#store_keyval]]).
 
* <code>summary</code> ~ ? not sure right now, probably name of the file with summary which could be found at <code>log_url</code>
 
* <code>summary</code> ~ ? not sure right now, probably name of the file with summary which could be found at <code>log_url</code>
 
* <code>highlights</code> ~ ? not sure right now, probably name of the file, which will contain 'digest' from the logs (created by the test by selecting appropriate error/warn messages etc.) with summary which could be found at <code>log_url</code>
 
* <code>highlights</code> ~ ? not sure right now, probably name of the file, which will contain 'digest' from the logs (created by the test by selecting appropriate error/warn messages etc.) with summary which could be found at <code>log_url</code>
Line 54: Line 54:
  
 
<code>start_phase (testrun_id, name)</code>
 
<code>start_phase (testrun_id, name)</code>
 +
 +
''Params''
 +
* <code></code>
 +
* <code></code>
  
 
=== end_phase ===
 
=== end_phase ===
  
 
<code>end_phase (testrun_id, result)</code>
 
<code>end_phase (testrun_id, result)</code>
 +
 +
''Params''
 +
* <code></code>
 +
* <code></code>
  
 
=== store_keyval ===
 
=== store_keyval ===
  
 
<code>store_keyval (testrun_id, keyval_pairs)</code>
 
<code>store_keyval (testrun_id, keyval_pairs)</code>
 +
 +
''Params''
 +
* <code></code>
 +
* <code></code>
  
 
== Workflows ==
 
== Workflows ==
Line 98: Line 110:
 
<pre>
 
<pre>
 
job_id = start_job ()
 
job_id = start_job ()
   testrun_id = start_testrun ("http://fedoraproject.org/wiki/QA:Some_test_page")
+
   testrun_id = start_testrun ("http://fedoraproject.org/wiki/QA:Some_test_page", job_id)
 
     start_phase (testrun_id, "First phase")
 
     start_phase (testrun_id, "First phase")
 
     end_phase (testrun_id, "PASSED")
 
     end_phase (testrun_id, "PASSED")
 
   end_testrun (testrun_id, "PASSED", log_url)
 
   end_testrun (testrun_id, "PASSED", log_url)
  
   testrun_id = start_testrun ("http://fedoraproject.org/wiki/QA:Some_other_test_page")
+
   testrun_id = start_testrun ("http://fedoraproject.org/wiki/QA:Some_other_test_page", job_id)
 
     start_phase (testrun_id, "First phase")
 
     start_phase (testrun_id, "First phase")
 
     end_phase (testrun_id, "PASSED")
 
     end_phase (testrun_id, "PASSED")
 
   end_testrun (testrun_id, "PASSED", log_url)
 
   end_testrun (testrun_id, "PASSED", log_url)
 
</pre>
 
</pre>

Revision as of 14:42, 12 April 2010

Stop (medium size).png
Draft
This page is only draft, and will change in time.
Idea.png
See ResultsDB schema
Knowledge from AutoQA_resultsdb_schema may be required.

Syntax Description

method_name (arg1, [arg2, arg3 = "Foo"]) -> return_value

  • method_name ~ name of the respective method (see #Methods)
  • arg1 ~ required argument
  • arg2 ~ optional argument, default value is set to None
  • arg3 ~ optional argument, default value is set to "Foo"
  • -> return_value ~ method gives back the return_value

Methods

start_job

start_job ([testplan_url]) -> job_id

Params

  • testplan_url ~ link to wiki page with metadata (usefull for frontends)

Returns

  • job_id ~ job identifier for Job <-> Testrun relationship.

Intended to be used mostly by the AutoQA scheduler, when one will need to logically connect results of more tests for one package/repo/... The job_id value will then be passed to the test probably via control file (i.e. another argument for job.run())

start_testrun

start_testrun (test_url, [job_id]) -> testrun_id

Params

  • test_url ~ link to wiki page with metadata (usefull for frontends)
  • job_id ~ optional argument. If set, new record will be created in the Job <-> Testrun relationship table.

Returns

  • testrun_id ~ identifier of the record inside Testrun table.

Use to create new entry in the Testrun table. Sets up the start_time and creates new entry in the Job<->Testrun relationship table, if job_id was set. Returns testrun_id which is required as an argument for almost every method. testrun_id is the key identifying the relationship between Testrun and the other tables in database.

end_testrun

end_testrun (testrun_id, result, log_url, [keyval_pairs, summary, highlights, score])

Params

  • testrun_id ~ Testrun identifier (see #start_testrun
  • result ~ PASSED, FAILED, INFO, ... (see <<Result>> at ResultsDB schema)
  • log_url ~ URL pointing to logs etc. (most probably in the Autotest storage)
  • keyval_pairs ~ Dictionary (JSON?) of key-value pairs to be stored (see #store_keyval).
  • summary ~ ? not sure right now, probably name of the file with summary which could be found at log_url
  • highlights ~ ? not sure right now, probably name of the file, which will contain 'digest' from the logs (created by the test by selecting appropriate error/warn messages etc.) with summary which could be found at log_url
  • score ~ ? not sure. kparal?

start_phase

start_phase (testrun_id, name)

Params

end_phase

end_phase (testrun_id, result)

Params

store_keyval

store_keyval (testrun_id, keyval_pairs)

Params

Workflows

Simple

testrun_id = start_testrun ("http://fedoraproject.org/wiki/QA:Some_test_page")
end_testrun (testrun_id, "PASSED", log_url)

Phases - simple

testrun_id = start_testrun ("http://fedoraproject.org/wiki/QA:Some_test_page")
  start_phase (testrun_id, "First phase")
  end_phase (testrun_id, "PASSED")
  start_phase (testrun_id, "Second phase")
  end_phase (testrun_id, "PASSED")
end_testrun (testrun_id, "PASSED", log_url)

Phases - nested

testrun_id = start_testrun ("http://fedoraproject.org/wiki/QA:Some_test_page")
  start_phase (testrun_id, "First phase")
    start_phase (testrun_id, "Second phase")
    end_phase (testrun_id, "PASSED")
  end_phase (testrun_id, "PASSED")
end_testrun (testrun_id, "PASSED", log_url)

Using Job

job_id = start_job ()
  testrun_id = start_testrun ("http://fedoraproject.org/wiki/QA:Some_test_page", job_id)
    start_phase (testrun_id, "First phase")
    end_phase (testrun_id, "PASSED")
  end_testrun (testrun_id, "PASSED", log_url)

  testrun_id = start_testrun ("http://fedoraproject.org/wiki/QA:Some_other_test_page", job_id)
    start_phase (testrun_id, "First phase")
    end_phase (testrun_id, "PASSED")
  end_testrun (testrun_id, "PASSED", log_url)