Commit 2762493f authored by Xavier Thompson's avatar Xavier Thompson

test_slapproxy: Test forwarded requests migration

Insert duplicate entries in `forwarded_partition_request` table of each
database dump of previous versions, and assert that only a single entry
remains after the migration.
parent ca3d9cd6
......@@ -2369,6 +2369,14 @@ class _MigrationTestCase(TestInformation, TestRequest, TestSlaveRequest, TestMul
[(u'slappart0', u'computer', u'slappart0', u'127.0.0.1', u'255.255.255.255'), (u'slappart0', u'computer', u'slappart0', u'fc00::1', u'ffff:ffff:ffff::'), (u'slappart1', u'computer', u'slappart1', u'127.0.0.1', u'255.255.255.255'), (u'slappart1', u'computer', u'slappart1', u'fc00::1', u'ffff:ffff:ffff::'), (u'slappart2', u'computer', u'slappart2', u'127.0.0.1', u'255.255.255.255'), (u'slappart2', u'computer', u'slappart2', u'fc00::1', u'ffff:ffff:ffff::'), (u'slappart3', u'computer', u'slappart3', u'127.0.0.1', u'255.255.255.255'), (u'slappart3', u'computer', u'slappart3', u'fc00::1', u'ffff:ffff:ffff::'), (u'slappart4', u'computer', u'slappart4', u'127.0.0.1', u'255.255.255.255'), (u'slappart4', u'computer', u'slappart4', u'fc00::1', u'ffff:ffff:ffff::'), (u'slappart5', u'computer', u'slappart5', u'127.0.0.1', u'255.255.255.255'), (u'slappart5', u'computer', u'slappart5', u'fc00::1', u'ffff:ffff:ffff::'), (u'slappart6', u'computer', u'slappart6', u'127.0.0.1', u'255.255.255.255'), (u'slappart6', u'computer', u'slappart6', u'fc00::1', u'ffff:ffff:ffff::'), (u'slappart7', u'computer', u'slappart7', u'127.0.0.1', u'255.255.255.255'), (u'slappart7', u'computer', u'slappart7', u'fc00::1', u'ffff:ffff:ffff::'), (u'slappart8', u'computer', u'slappart8', u'127.0.0.1', u'255.255.255.255'), (u'slappart8', u'computer', u'slappart8', u'fc00::1', u'ffff:ffff:ffff::'), (u'slappart9', u'computer', u'slappart9', u'127.0.0.1', u'255.255.255.255'), (u'slappart9', u'computer', u'slappart9', u'fc00::1', u'ffff:ffff:ffff::')]
)
# Check that duplicate forwarded requests in the initial table result in a single entry in the new table
if any(t.startswith('forwarded_partition_request') for t in self.initial_table_list):
forwarded_request_list = self.db.execute("select * from forwarded_partition_request{}".format(self.current_version)).fetchall()
self.assertEqual(
forwarded_request_list,
[('forwarded_instance', 'https://bogus/master/url')]
)
# Check that we only have new tables
table_list = self.db.execute("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name").fetchall()
self.assertEqual([x[0] for x in table_list],
......
......@@ -120,4 +120,6 @@ CREATE TABLE forwarded_partition_request11 (
partition_reference VARCHAR(255), -- a.k.a source_instance_id
master_url VARCHAR(255)
);
INSERT INTO "forwarded_partition_request11" VALUES('forwarded_instance','https://bogus/master/url');
INSERT INTO "forwarded_partition_request11" VALUES('forwarded_instance','https://bogus/master/url');
COMMIT;
......@@ -121,4 +121,6 @@ CREATE TABLE forwarded_partition_request12 (
partition_reference VARCHAR(255), -- a.k.a source_instance_id
master_url VARCHAR(255)
);
INSERT INTO "forwarded_partition_request12" VALUES('forwarded_instance','https://bogus/master/url');
INSERT INTO "forwarded_partition_request12" VALUES('forwarded_instance','https://bogus/master/url');
COMMIT;
......@@ -121,4 +121,6 @@ CREATE TABLE forwarded_partition_request13 (
partition_reference VARCHAR(255), -- a.k.a source_instance_id
master_url VARCHAR(255)
);
INSERT INTO "forwarded_partition_request13" VALUES('forwarded_instance','https://bogus/master/url');
INSERT INTO "forwarded_partition_request13" VALUES('forwarded_instance','https://bogus/master/url');
COMMIT;
......@@ -122,4 +122,6 @@ CREATE TABLE forwarded_partition_request14 (
partition_reference VARCHAR(255), -- a.k.a source_instance_id
master_url VARCHAR(255)
);
INSERT INTO "forwarded_partition_request14" VALUES('forwarded_instance','https://bogus/master/url');
INSERT INTO "forwarded_partition_request14" VALUES('forwarded_instance','https://bogus/master/url');
COMMIT;
......@@ -126,4 +126,6 @@ CREATE TABLE forwarded_partition_request15 (
partition_reference VARCHAR(255), -- a.k.a source_instance_id
master_url VARCHAR(255)
);
INSERT INTO "forwarded_partition_request15" VALUES('forwarded_instance','https://bogus/master/url');
INSERT INTO "forwarded_partition_request15" VALUES('forwarded_instance','https://bogus/master/url');
COMMIT;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment