<commit_before>require 'rubygems'
require 'bundler/setup'

ENV['RACK_ENV'] = 'test'

require 'knockoff'

ActiveRecord::Base.configurations = {
  'test' => { adapter: 'sqlite3', database: 'tmp/test_db' }
}

# Setup the ENV's for replicas
ENV['KNOCKOFF_REPLICA1'] = 'sqlite3:tmp/test_replica_db'
ENV['KNOCKOFF_REPLICA_ENVS'] = 'KNOCKOFF_REPLICA1'

# Prepare databases
class User < ActiveRecord::Base
end

# Create two records on master
ActiveRecord::Base.establish_connection(:test)
ActiveRecord::Base.connection.create_table :users, force: true
User.create
User.create

# Create one record on slave, emulating replication lag
ActiveRecord::Base.establish_connection(ENV['KNOCKOFF_REPLICA1'])
ActiveRecord::Base.connection.create_table :users, force: true
User.create

# Reconnect to master
ActiveRecord::Base.establish_connection(:test)<commit_msg>Config update needed to get tests running<commit_after>require 'rubygems'
require 'bundler/setup'

ENV['RACK_ENV'] = 'test'

require 'knockoff'

ActiveRecord::Base.configurations = {
  'test' => { 'adapter' => 'sqlite3', 'database' => 'tmp/test_db' }
}

# Setup the ENV's for replicas
ENV['KNOCKOFF_REPLICA1'] = 'sqlite3:tmp/test_replica_db'
ENV['KNOCKOFF_REPLICA_ENVS'] = 'KNOCKOFF_REPLICA1'

# Prepare databases
class User < ActiveRecord::Base
end

# Create two records on master
ActiveRecord::Base.establish_connection(:test)
ActiveRecord::Base.connection.create_table :users, force: true
User.create
User.create

# Create one record on slave, emulating replication lag
ActiveRecord::Base.establish_connection(ENV['KNOCKOFF_REPLICA1'])
ActiveRecord::Base.connection.create_table :users, force: true
User.create

# Reconnect to master
ActiveRecord::Base.establish_connection(:test)
{'fraction_non_alphanumeric': 0.12023121387283237, 'fraction_numerical': 0.005780346820809248, 'mean_word_length': 7.527093596059113, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7617327', 'n_tokens_mistral': 597, 'n_tokens_neox': 565, 'n_words': 123}