Skip to content

Commit

Permalink
Merge pull request #208 from azuchi/fix-ci-error
Browse files Browse the repository at this point in the history
Fix ci error
  • Loading branch information
rantan authored Jan 31, 2025
2 parents 75a7748 + db593a4 commit 04276d5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ gemspec

gem "rake", "~> 12.0"
gem "rspec", "~> 3.0"
gem "docker-api", "~> 2.1.0"
gem "docker-api", "~> 2.4.0"

gem "simplecov", require: false
2 changes: 1 addition & 1 deletion spec/functional/token_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
amount: 10_000,
fee_estimator: fee_estimator
)
rescue Errno::ECONNREFUSED
rescue Errno::ECONNREFUSED, Errno::ECONNRESET
# Ignored
end
expect(Glueby::Contract::AR::ReissuableToken.count).to eq(1)
Expand Down
31 changes: 25 additions & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,31 @@ def sqlite3_config
end

def setup_database(config: sqlite3_config)

::ActiveRecord::Base.establish_connection(config)
connection = ::ActiveRecord::Base.connection
connection.create_table :glueby_wallets do |t|
t.string :wallet_id
t.timestamps
try = 0
begin
sleep(1)
::ActiveRecord::Base.establish_connection(config)
connection = ::ActiveRecord::Base.connection
connection.create_table :glueby_wallets do |t|
t.string :wallet_id
t.timestamps
end
rescue ActiveRecord::ConnectionNotEstablished
try += 1
if try < 30
retry
else
raise
end
rescue ActiveRecord::NoDatabaseError
client = Mysql2::Client.new(
:host => config[:host],
:username => config[:username],
:password => config[:password]
)
client.query("CREATE DATABASE #{config[:database]}")
client.query("USE #{config[:database]}")
retry
end
connection.add_index :glueby_wallets, [:wallet_id], unique: true

Expand Down

0 comments on commit 04276d5

Please sign in to comment.