Comments (2)
I think I found a workaround.
It's not pretty but at least I can now restore tests in my Gitlab CI. 😅
First of all, the issue with URI
's name resolution is likely fixable by applying this patch to activerecord (v6.1.4.4 in my case):
diff --git a/lib/active_record/database_configurations/connection_url_resolver.rb b/lib/active_record/database_configurations/connection_url_resolver.rb
index 13fddb9..a136243 100644
--- a/lib/active_record/database_configurations/connection_url_resolver.rb
+++ b/lib/active_record/database_configurations/connection_url_resolver.rb
@@ -1,5 +1,6 @@
# frozen_string_literal: true
+require "uri"
require "active_support/core_ext/enumerable"
module ActiveRecord
@@ -44,7 +45,7 @@ module ActiveRecord
attr_reader :uri
def uri_parser
- @uri_parser ||= URI::Parser.new
+ @uri_parser ||= ::URI::Parser.new
end
# Converts the query parameters of the URI into a hash.
As far as I know there's not this kind of fix on 6.x, yet so the question is how to fix it in the meanwhile.
I created a testing repository of activerecord v6.1.4.4 here: https://github.com/olistik/activerecord-test/
It contains the abovementioned patch.
Then I put this conditional require in my Gemfile and updated my .gitlab-ci.yml
accordingly:
Gemfile:
# Because of an issue faced in Gitlab CI between database_cleaner and activerecord.
# see https://github.com/DatabaseCleaner/database_cleaner/issues/686
if ENV['GITLAB_CI'] == 'true'
gem 'activerecord', github: 'olistik/activerecord-test'
end
.gitlab-ci.yml:
- GITLAB_CI=true bundle install --no-binstubs -j $(nproc) --path vendor # Install dependencies
Hope to be helpful for someone in a similar situation. <3
Feel free to propose better solutions. 🎩
from database_cleaner.
I upgraded Rails to 6.1.6 and the problem somehow disappeared from my pipeline.
I did a quick scan of Rails' changelog but couldn't find a direct fix so 🤷🏻♂️ 😅
from database_cleaner.
Related Issues (20)
- DatabaseCleaner triggering `before` hook while threads are still running HOT 2
- url_allowlist only works against DATABASE_URL HOT 1
- Data
- Remote database is wiped out HOT 2
- API documentation is empty HOT 1
- YAML aliases with Ruby 3.1 HOT 8
- Hand soap HOT 1
- NoMethodError: undefined method 'state' for nil:NilClass HOT 7
- Change strategy for specific test
- 0.0.0.0 doesn't count as a local host HOT 2
- Rspec tests freeze as soon as DatabaseCleaner begins to work HOT 1
- Feature spec should complete after showing the result
- Prevent cleaning of development database HOT 1
- Highly variable duration of truncations (not a database_cleaner issue)
- Deprecation warning on: DatabaseCleaner.clean_with(:truncation) HOT 1
- Reading Database config from database.yml HOT 1
- Is this gem compatible with ruby 3.2.2 HOT 1
- Issue with Rails 7.2
- NoMethodError error schema_migration with Rails 7.2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from database_cleaner.