def test_workflows(cluster): primary_dsn = create_temporary_database('primary') replica_dsn = create_temporary_database('replica') replication_set = ReplicationSetConfiguration() replication_set.database.dsn = primary_dsn replication_set.tables.add( name='auth_user', primary_keys=['id'], ) with cluster: create_set(cluster, 'example', replication_set) replication_set.database.dsn = replica_dsn replication_set.tables.add(name='accounts_userprofile', primary_keys=['id'], columns=['id', 'user_id', 'display_name']) update_set(cluster, 'example', replication_set) upgrade_cluster(cluster, force=True) del replication_set.tables[0] update_set(cluster, 'example', replication_set) drop_set(cluster, 'example')
def test_workflows(cluster): primary_dsn = create_temporary_database('primary') replica_dsn = create_temporary_database('replica') replication_set = ReplicationSetConfiguration() replication_set.database.dsn = primary_dsn replication_set.tables.add( name='auth_user', primary_keys=['id'], ) with cluster: create_set(cluster, 'example', replication_set) replication_set.database.dsn = replica_dsn replication_set.tables.add( name='accounts_userprofile', primary_keys=['id'], columns=['id', 'user_id', 'display_name'] ) update_set(cluster, 'example', replication_set) upgrade_cluster(cluster, force=True) del replication_set.tables[0] update_set(cluster, 'example', replication_set) drop_set(cluster, 'example')
def update(cluster, name, configuration): codec = TextCodec(ReplicationSetConfiguration) configuration = codec.decode(configuration.read()) # TODO: Support forced removal again. with cluster: return administration.update_set(cluster, name, configuration)