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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ executors:
- image: *image
- image: cimg/mysql:5.7

sqlite:
working_directory: *workdir
environment:
<<: *environment
DB: sqlite
docker:
- image: *image

Comment on lines +40 to +47
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

commands:
setup:
steps:
Expand Down Expand Up @@ -139,6 +147,14 @@ jobs:
- setup
- test

sqlite:
executor: sqlite
parallelism: *parallelism
steps:
- setup
- libvips
- test

postgres_rails60:
executor: postgres
parallelism: *parallelism
Expand Down Expand Up @@ -168,6 +184,7 @@ workflows:
only: /master|v\d\.\d+/
- postgres
- mysql
- sqlite
- postgres_rails61
- postgres_rails60
- postgres_rails52
Expand Down
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ group :backend, :frontend, :core, :api do
end

group :backend, :frontend do
# 'net/http' is required by 'capybara/server', triggering
# a few "already initialized constant" warnings when loaded
# from default gems. See:
# - https://github.com/ruby/net-protocol/issues/10
# - https://stackoverflow.com/a/72474475
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3')
gem 'net-http', require: false
end

gem 'capybara', '~> 3.13', require: false
gem 'capybara-screenshot', '>= 1.0.18', require: false
gem 'selenium-webdriver', require: false
Expand Down
4 changes: 0 additions & 4 deletions api/spec/requests/spree/api/checkouts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 🍀


put spree.api_checkout_path(order),
params: { order_token: order.guest_token, order: {
bill_address_attributes: address,
Expand All @@ -109,8 +107,6 @@ module Spree::Api

# Regression test for https://github.com/spree/spree/issues/4498
it "does not contain duplicate variant data in delivery return" do
pending "SQLite adapter fails to provide a unique index" if ActiveRecord::Base.connection.adapter_name == "SQLite"

put spree.api_checkout_path(order),
params: { order_token: order.guest_token, order: {
bill_address_attributes: address,
Expand Down
7 changes: 4 additions & 3 deletions api/spec/requests/spree/api/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ module Spree::Api
expect(json_response['email']).to eq '[email protected]'
end

# there's no validations on LegacyUser?
xit "cannot create a new user with invalid attributes" do
post spree.api_users_path, params: { user: {}, token: user.spree_api_key }
it "cannot create a new user with invalid attributes" do
allow_any_instance_of(Spree::LegacyUser).to receive(:save).and_return(false)

post spree.api_users_path, params: { user: { email: '[email protected]' }, token: user.spree_api_key }
expect(response.status).to eq(422)
expect(json_response["error"]).to eq("Invalid resource. Please fix errors and try again.")
end
Expand Down
3 changes: 2 additions & 1 deletion core/lib/spree/testing_support/dummy_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.

❤️


if auto_migrate
DummyApp::Migrations.auto_migrate
Expand Down Expand Up @@ -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.

❤️


config.assets.paths << File.expand_path('dummy_app/assets/javascripts', __dir__)
config.assets.paths << File.expand_path('dummy_app/assets/stylesheets', __dir__)
Expand Down