Skip to content

Commit

Permalink
test: update test to also verify upgrades work fine and new plugins a…
Browse files Browse the repository at this point in the history
…re still supported in v20

Signed-off-by: Manan Gupta <manan@planetscale.com>
  • Loading branch information
GuptaManan100 committed Jul 9, 2024
1 parent 73d2627 commit caec7d6
Showing 1 changed file with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions go/test/endtoend/reparent/semisync/semi_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,46 @@ func TestSemiSyncUpgradeDowngrade(t *testing.T) {
// Verify we are using the correct vttablet version.
verifyVttabletVersion(t, replica, 20)
// Check the plugin loaded in vttablet.
require.EqualValues(t, mysql.SemiSyncTypeSource, semiSyncExtensionLoaded(t, replica))
require.EqualValues(t, mysql.SemiSyncTypeMaster, semiSyncExtensionLoaded(t, replica))

// change vttablet binary and downgrade it.
changeVttabletBinary(t, replica, "vttabletold")
// Verify we are using the older vttablet version.
verifyVttabletVersion(t, replica, 19)
t.Run("Downgrade to v19", func(t *testing.T) {
// change vttablet binary and downgrade it.
changeVttabletBinary(t, replica, "vttabletold")
// Verify we are using the older vttablet version.
verifyVttabletVersion(t, replica, 19)
// Verify that replication is running as intended.
utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]})
// Check the plugin loaded in vttablet.
require.EqualValues(t, mysql.SemiSyncTypeMaster, semiSyncExtensionLoaded(t, replica))
})

t.Run("Upgrade to v19", func(t *testing.T) {
// change vttablet binary and downgrade it.
changeVttabletBinary(t, replica, "vttablet")
// Verify we are using the older vttablet version.
verifyVttabletVersion(t, replica, 20)
// Verify that replication is running as intended.
utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]})
// Check the plugin loaded in vttablet.
require.EqualValues(t, mysql.SemiSyncTypeMaster, semiSyncExtensionLoaded(t, replica))
})

t.Run("Change the semi-sync plugin", func(t *testing.T) {
// Change MySQL plugins loaded.
utils.RunSQLs(context.Background(), t, []string{
`SET GLOBAL READ_ONLY=OFF`,
`STOP REPLICA;`,
`UNINSTALL PLUGIN rpl_semi_sync_master;`,
`UNINSTALL PLUGIN rpl_semi_sync_slave;`,
`INSTALL PLUGIN rpl_semi_sync_source SONAME 'semisync_source.so';`,
`INSTALL PLUGIN rpl_semi_sync_replica SONAME 'semisync_replica.so';`,
`START REPLICA;`,
}, replica)
// Check the plugin loaded in vttablet.
require.EqualValues(t, mysql.SemiSyncTypeSource, semiSyncExtensionLoaded(t, replica))
// Verify that replication is running as intended.
utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]})
})
}

// semiSyncExtensionLoaded checks if the semisync extension has been loaded.
Expand Down

0 comments on commit caec7d6

Please sign in to comment.