Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TKO rpc_interface_unittests.py failures on other database backends #594

Open
clebergnu opened this issue Feb 25, 2013 · 0 comments
Open
Assignees

Comments

@clebergnu
Copy link
Member

With the database changes that are due to arrive on next, running the unit tests against other RDBMs is now possible.

My testing was done with MySQL, and there are two unit tests that fail:

  • test_filtering_on_machine_label_fields
  • test_filtering_on_test_label_fields

The generated SQL by Django's ORM + custom model logic in the frontend code is bad code, and MySQL can not run it.

This is an example of the SQL generated on test_filtering_on_machine_label_fields already with query parameters applied:

SELECT
    (DATE(test_finished_time)) AS `DATE(test_finished_time)`,
    (DATE(job_queued_time)) AS `DATE(job_queued_time)`,
    (IF(`machine_label_label1`.id IS NOT NULL, 'label1', NULL)) AS `machine_label_label1`,
    `tko_test_view_2`.`test_idx`,
    `tko_test_view_2`.`job_idx`,
    `tko_test_view_2`.`test_name`,
    `tko_test_view_2`.`subdir`,
    `tko_test_view_2`.`kernel_idx`,
    `tko_test_view_2`.`status_idx`,
    `tko_test_view_2`.`reason`,
    `tko_test_view_2`.`machine_idx`,
    `tko_test_view_2`.`test_started_time`,
    `tko_test_view_2`.`test_finished_time`,
    `tko_test_view_2`.`job_tag`,
    `tko_test_view_2`.`job_name`,
    `tko_test_view_2`.`job_owner`,
    `tko_test_view_2`.`job_queued_time`,
    `tko_test_view_2`.`job_started_time`,
    `tko_test_view_2`.`job_finished_time`,
    `tko_test_view_2`.`afe_job_id`,
    `tko_test_view_2`.`hostname`,
    `tko_test_view_2`.`platform`,
    `tko_test_view_2`.`machine_owner`,
    `tko_test_view_2`.`kernel_hash`,
    `tko_test_view_2`.`kernel_base`,
    `tko_test_view_2`.`kernel`,
    `tko_test_view_2`.`status`
FROM 
    `tko_test_view_2` LEFT OUTER JOIN `tko_test_attributes`  AS `machine_label_label1`
     ON
         (`machine_label_label1`.`test_idx` = `tko_test_view_2`.`test_idx`
         AND ((`machine_label_label1`.`attribute` = 'host-labels' AND FIND_IN_SET('label1', `machine_label_label1`.value)))
         )
WHERE machine_label_label1 = "label1";

And the error:

ERROR 1054 (42S22): Unknown column 'machine_label_label1' in 'where clause'

It looks like this will involve changes to the model custom logic, which is already in need of simplification.

Since running the unit tests against other database backends has never been supported, and running it now requires changes to the code this is not a regression, but a new condition.

Anyway, let's keep track of it and try to solve it ASAP to officially allow and support running the unit tests against all database backends.

@ghost ghost assigned clebergnu Feb 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant