Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a SQLite job to the CI #4525

Merged
merged 6 commits into from
Aug 25, 2022
Merged

Conversation

elia
Copy link
Member

@elia elia commented Aug 23, 2022

While running specs locally I noticed that those two pending examples were successful.
Also restored another skipped commit.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

  • I have written a thorough PR description.
  • I have kept my commits small and atomic.
  • I have used clear, explanatory commit messages.

The following are not always needed (cross them out if they are not):

  • I have added automated tests to cover my changes.
  • I have attached screenshots to demo visual changes.
  • I have opened a PR to update the guides.
  • I have updated the readme to account for my changes.

@waiting-for-dev
Copy link
Contributor

Hey, @elia, thanks for your PR. Please, see #4019 (comment)

@elia
Copy link
Member Author

elia commented Aug 23, 2022

thanks @waiting-for-dev good call, I'll remove the CI commit and keep the rest.

However it seems like the CI took the usual 13min, @kennyadsl can we resume #4019 now?
Having local tests trigger this kind of PR from multiple people might be a hint we should have it covered.

@elia elia force-pushed the elia/test-sqlite branch from b3b2fb4 to 158de04 Compare August 23, 2022 12:00
@kennyadsl
Copy link
Member

@elia it's taking way less now because Nebulab is taking care of the CI costs (we should probably pay with Open Collective funds for that, but that's another story) and we have more jobs in parallel. That said, it may be time to resume #4019 now, or incorporate that same change in this PR.

@elia
Copy link
Member Author

elia commented Aug 23, 2022

@kennyadsl thanks! I'll add that commit to this PR and open for review once green 👍

elia and others added 6 commits August 23, 2022 16:05
Added a valid user param so that the action is not stopped by strong
parameters.
They pass with recent SQLite versions.
'net/http' is required by 'capybara/server', triggering a few "already
initialized constant" warnings when loaded from default gems. See:
- ruby/net-protocol#10
- https://stackoverflow.com/a/72474475
When running bin/build with the default postgres adapter the DummyApp
will interrupt the loading of the spec_helper. This means that the
first spec will report the correct error (ActiveRecord::DatabaseConnectionError)
but each following spec will try to load the spec_helper again and
will report a confusing "Application has been already initialized."
error.

With this change the original ActiveRecord::DatabaseConnectionError
will be reported for every spec, making it easier to fix it.
The SQLite adapter is the default while developing locally and for
dummy apps, even if unlikely to be used by anyone in production we
need to be sure it keeps working.

The test suite was only run against mysql and postgres.
@elia elia force-pushed the elia/test-sqlite branch from 158de04 to e81727d Compare August 23, 2022 14:06
@elia elia marked this pull request as ready for review August 23, 2022 16:59
Copy link
Contributor

@forkata forkata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thanks @elia, these changes look great!

Comment on lines +40 to +47
sqlite:
working_directory: *workdir
environment:
<<: *environment
DB: sqlite
docker:
- image: *image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should add this to the https://github.com/solidusio/circleci-orbs-extensions repo as well so extensions also can opt-in to running specs against SQLite on CI?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in solidusio/circleci-orbs-extensions#48, will be released in v0.4.0

@@ -82,8 +82,6 @@ module Spree::Api
end

it "can update addresses and transition from address to delivery" do
pending "SQLite adapter fails to provide a unique index" if ActiveRecord::Base.connection.adapter_name == "SQLite"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed with the Docker setup that the tests are green now 🍀

@@ -38,7 +38,7 @@ def self.setup(gem_root:, lib_name:, auto_migrate: true)
ENV["LIB_NAME"] = lib_name
DummyApp::Application.config.root = File.join(gem_root, 'spec', 'dummy')

DummyApp::Application.initialize!
DummyApp::Application.initialize! unless DummyApp::Application.initialized?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@@ -116,6 +116,7 @@ class Application < ::Rails::Application
end
config.paths['db/migrate'] = migration_dirs
ActiveRecord::Migrator.migrations_paths = migration_dirs
ActiveRecord::Migration.verbose = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Contributor

@waiting-for-dev waiting-for-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @elia!

@waiting-for-dev waiting-for-dev added changelog:solidus_api Changes to the solidus_api gem changelog:solidus_core Changes to the solidus_core gem type:enhancement Proposed or newly added feature labels Aug 25, 2022
@kennyadsl kennyadsl merged commit 008192c into solidusio:master Aug 25, 2022
@kennyadsl kennyadsl deleted the elia/test-sqlite branch August 25, 2022 09:43
@elia
Copy link
Member Author

elia commented Aug 26, 2022

@forkata sure! I'll work that today 👍
I'd also feel more confident if we open the test matrix to all supported ruby and rails versions, both in solidus and for extensions, but let's take one step at a time 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_api Changes to the solidus_api gem changelog:solidus_core Changes to the solidus_core gem type:enhancement Proposed or newly added feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants