Merge lp:~matsubara/ubuntu-test-cases/lamp-bug-1443987 into lp:ubuntu-test-cases/server

Proposed by Diogo Matsubara
Status: Merged
Merged at revision: 100
Proposed branch: lp:~matsubara/ubuntu-test-cases/lamp-bug-1443987
Merge into: lp:ubuntu-test-cases/server
Diff against target: 71 lines (+38/-3)
2 files modified
testsuites/lamp/test_mysql_show_tables/tc_control (+4/-2)
testsuites/lamp/test_mysql_show_tables/test.py (+34/-1)
To merge this branch: bzr merge lp:~matsubara/ubuntu-test-cases/lamp-bug-1443987
Reviewer Review Type Date Requested Status
Robie Basak Approve
Paul Larson (community) Approve
Review via email: mp+256347@code.launchpad.net

This proposal supersedes a proposal from 2015-04-15.

Commit message

Update lamp test case that checks the number of default mysql tables installed

Description of the change

Hi, this branch fixes the failing vivid smoke test for LAMP[1] by updating the number of default MySQL tables the test looks for. I have a question though, if I update this branch, will older releases such as trusty rely on this new test case? If yes, those are going to fail as well since on trusty the default mysql version installs only 24 tables, IIRC.

Should I special case the test case or does trusty use another branch for its test runs?

[1] http://d-jenkins.ubuntu-ci:8080/job/vivid-server-i386-smoke-lamp/

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

Would this break things in the trusty jobs though? It looks like there have been no daily images for trusty in a while, but I'm guessing there will be at some point right?

review: Needs Information
Revision history for this message
Diogo Matsubara (matsubara) wrote :

I believe it might break the test case for Trusty. Looking at the console output of the last Trusty run[1] it branches the test suite from lp:ubuntu-test-cases/server

So, what's usually the way to handle cases like this? Have a specific branch for trusty and update the trusty jobs to use that branch or special case in the test suite itself?

Thanks for the review!

[1] http://d-jenkins.ubuntu-ci:8080/job/trusty-server-i386-smoke-lamp/174/consoleFull of the last run

Revision history for this message
Paul Larson (pwlars) wrote :

I don't think this is something we've had to deal with before, so there's not a "usual" solution, but I'm sure we can come up with something that doesn't require forking for each release. How about either:
1. detecting whether we are on a release before or after vivid and adjusting the expectation based on that

-or-

2. Improving the test to look for at least a few known table names that exist in both releases rather than just look at the number of list items after calling split().

I think I like #2 better personally, but I don't think that's the only solution.

101. By Diogo Matsubara

update LAMP tests to check for some expected tables in the MySQL database as well as checking for a minimum of 24 tables in it.

Revision history for this message
Diogo Matsubara (matsubara) wrote :

Hi Paul,

I updated the tests to take into account the fact that there are differences between Trusty and Vivid default MySQL install. It now checks for existing tables on both installs as well as checking for a minimum of 24 tables.

I used this data to come up with the expected table names:

trusty-mysql-tables.out -> http://paste.ubuntu.com/10833234/
vivid-mysql-tables.out -> http://paste.ubuntu.com/10833235/
diff -u trusty-mysql-tables.out vivid-mysql-tables.out -> http://paste.ubuntu.com/10833233/

Revision history for this message
Paul Larson (pwlars) wrote :

This seems better to me. +1

review: Approve
Revision history for this message
Robie Basak (racb) wrote :

I'm happy that this modification of the test case will continue to effectively test the MySQL install in both Trusty and Vivid. +1.

review: Approve
Revision history for this message
Diogo Matsubara (matsubara) wrote :

Thanks for the review Robie and Paul. I tried to push the changes to lp:ubuntu-test-cases/server but I don't have permission (One needs to be in ~ubuntu-server-dev). Could you push it for me please?

102. By Diogo Matsubara

fix typo in set method.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'testsuites/lamp/test_mysql_show_tables/tc_control'
2--- testsuites/lamp/test_mysql_show_tables/tc_control 2012-11-14 10:56:53 +0000
3+++ testsuites/lamp/test_mysql_show_tables/tc_control 2015-04-30 08:39:51 +0000
4@@ -3,10 +3,12 @@
5 pre_conditions: The machine has been provisioned with a LAMP server
6 action: |
7 1. List the tables in the database mysql
8- 2. Check if there are 24 tables in the database
9+ 2. Check a list of default tables exist in the database
10+ 3. Check if there are 24 or more tables in the database
11 expected_results: |
12 1. The query lists the tables in mysql database
13- 2. There are 24 tables in it
14+ 2. There are some default tables in it
15+ 3. There are 24 or more tables in it
16 type: userland
17 run_as: root
18 timeout: 200
19
20=== modified file 'testsuites/lamp/test_mysql_show_tables/test.py'
21--- testsuites/lamp/test_mysql_show_tables/test.py 2013-03-01 17:39:50 +0000
22+++ testsuites/lamp/test_mysql_show_tables/test.py 2015-04-30 08:39:51 +0000
23@@ -27,6 +27,33 @@
24 logging.basicConfig(level=logging.INFO)
25
26
27+# Tables known to exist on a default install for Trusty and Vivid.
28+EXPECTED_TABLES = set([
29+ 'columns_priv',
30+ 'db',
31+ 'event',
32+ 'func',
33+ 'general_log',
34+ 'help_category',
35+ 'help_keyword',
36+ 'help_relation',
37+ 'help_topic',
38+ 'ndb_binlog_index',
39+ 'plugin',
40+ 'proc',
41+ 'procs_priv',
42+ 'proxies_priv',
43+ 'servers',
44+ 'slow_log',
45+ 'tables_priv',
46+ 'time_zone',
47+ 'time_zone_leap_second',
48+ 'time_zone_name',
49+ 'time_zone_transition',
50+ 'time_zone_transition_type',
51+ 'user'])
52+
53+
54 class LampTest(unittest.TestCase):
55 def testMysqlShowTables(self):
56 cmd = ["mysql", "-e", "show tables",
57@@ -37,7 +64,13 @@
58
59 self.assertEqual(stderr, None)
60 logging.debug("Cmd output: %s" % (output))
61- self.assertEqual(len(output.strip().split("\n")), 24)
62+ result = output.strip().split("\n")
63+ # Check that the output contains some default tables.
64+ self.assertTrue(EXPECTED_TABLES.issubset(set(result)))
65+ # Check for a minimum of 24 tables as the number might vary between
66+ # releases. See bug 1443987.
67+ self.assertGreaterEqual(len(result), 24)
68+
69
70 if __name__ == '__main__':
71 unittest.main()

Subscribers

People subscribed via source and target branches