Mercurial > p > roundup > code
comparison test/test_mysql.py @ 6604:0d99ae7c8de6
Allow Roundup to use PostgreSQL database native full text search
back_postgreql.py - schema version changes for schema version 7.
configuration.py - added indexer_language checks for postgresql. Hardcoded
list for now.
Docs admin_guide and upgrading
Tests.
This also restructures the version upgrade tests for the rdbms
backends. They can run all of them now as the proper cascade is
developed to roll back changes to version 6.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 27 Jan 2022 19:48:48 -0500 |
| parents | 39189dd94f2c |
| children | 09d9c646ca89 |
comparison
equal
deleted
inserted
replaced
| 6603:57dc15ad648d | 6604:0d99ae7c8de6 |
|---|---|
| 72 self.db.commit() | 72 self.db.commit() |
| 73 | 73 |
| 74 if self.db.database_schema['version'] != 7: | 74 if self.db.database_schema['version'] != 7: |
| 75 self.skipTest("This test only runs for database version 7") | 75 self.skipTest("This test only runs for database version 7") |
| 76 | 76 |
| 77 self.db.database_schema['version'] = 6 | |
| 78 | 77 |
| 79 # test by shrinking _words and trying to insert a long value | 78 # test by shrinking _words and trying to insert a long value |
| 80 # it should fail. | 79 # it should fail. |
| 81 # run post-init | 80 # run post-init |
| 82 # same test should succeed. | 81 # same test should succeed. |
| 90 # DataError : Data too long for column '_word' at row 1 | 89 # DataError : Data too long for column '_word' at row 1 |
| 91 self.db.sql("insert into __words VALUES('%s',1)" % long_string) | 90 self.db.sql("insert into __words VALUES('%s',1)" % long_string) |
| 92 | 91 |
| 93 self.assertIn("Data too long for column '_word'", | 92 self.assertIn("Data too long for column '_word'", |
| 94 ctx.exception.args[1]) | 93 ctx.exception.args[1]) |
| 95 | 94 |
| 95 self.db.database_schema['version'] = 6 | |
| 96 | |
| 97 if hasattr(self,"downgrade_only"): | |
| 98 return | |
| 99 | |
| 96 # test upgrade altering row | 100 # test upgrade altering row |
| 97 self.db.post_init() | 101 self.db.post_init() |
| 98 | 102 |
| 99 # This insert with text of expected column size should succeed | 103 # This insert with text of expected column size should succeed |
| 100 self.db.sql("insert into __words VALUES('%s',1)" % long_string) | 104 self.db.sql("insert into __words VALUES('%s',1)" % long_string) |
| 101 | 105 |
| 102 # Verify it fails at one more than the expected column size | 106 # Verify it fails at one more than the expected column size |
| 103 too_long_string = "a" * (self.db.indexer.maxlength + 6) | 107 too_long_string = "a" * (self.db.indexer.maxlength + 6) |
| 104 with self.assertRaises(MySQLdb.DataError) as ctx: | 108 with self.assertRaises(MySQLdb.DataError) as ctx: |
| 105 self.db.sql("insert into __words VALUES('%s',1)" % too_long_string) | 109 self.db.sql("insert into __words VALUES('%s',1)" % too_long_string) |
| 110 | |
| 111 self.assertEqual(self.db.database_schema['version'], | |
| 112 self.db.current_db_version) | |
| 106 | 113 |
| 107 @skip_mysql | 114 @skip_mysql |
| 108 class mysqlROTest(mysqlOpener, ROTest, unittest.TestCase): | 115 class mysqlROTest(mysqlOpener, ROTest, unittest.TestCase): |
| 109 def setUp(self): | 116 def setUp(self): |
| 110 mysqlOpener.setUp(self) | 117 mysqlOpener.setUp(self) |
