Skip to content

Commit

Permalink
test: add 7.1 to test matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed Nov 30, 2023
1 parent 953b99c commit 05167d8
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/acceptance-tests-on-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
max-parallel: 4
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2"]
ar: ["~> 6.0.6", "~> 6.1.7", "~> 7.0.4"]
ar: ["~> 6.0.6", "~> 6.1.7", "~> 7.0.4", "~> 7.1.0"]
# Exclude combinations that are not supported.
exclude:
- ruby: "3.0"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
max-parallel: 4
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2"]
ar: ["~> 6.0.6", "~> 6.1.7", "~> 7.0.4"]
ar: ["~> 6.0.6", "~> 6.1.7", "~> 7.0.4", "~> 7.1.0"]
# Exclude combinations that are not supported.
exclude:
- ruby: "3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
matrix:
# Run acceptance tests all supported combinations of Ruby and ActiveRecord.
ruby: [2.7, 3.0, 3.1, 3.2]
ar: [6.0.0, 6.0.1, 6.0.2.2, 6.0.3.7, 6.0.4, 6.1.3.2, 6.1.4.7, 6.1.5.1, 6.1.6.1, 7.0.2.4, 7.0.3.1, 7.0.4, 7.0.5, 7.0.6, 7.0.7]
ar: [6.0.0, 6.0.1, 6.0.2.2, 6.0.3.7, 6.0.4, 6.1.3.2, 6.1.4.7, 6.1.5.1, 6.1.6.1, 7.0.2.4, 7.0.3.1, 7.0.4, 7.0.5, 7.0.6, 7.0.7, 7.1.0, 7.1.1, 7.1.2]
# Exclude combinations that are not supported.
exclude:
- ruby: 3.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
# Run unit tests all supported combinations of Ruby and ActiveRecord.
ruby: [2.7, 3.0, 3.1, 3.2]
ar: [6.0.0, 6.0.1, 6.0.2.2, 6.0.3.7, 6.0.4, 6.1.3.2, 6.1.4.7, 6.1.5.1, 6.1.6.1, 7.0.2.4, 7.0.3.1, 7.0.4, 7.0.5]
ar: [6.0.0, 6.0.1, 6.0.2.2, 6.0.3.7, 6.0.4, 6.1.3.2, 6.1.4.7, 6.1.5.1, 6.1.6.1, 7.0.2.4, 7.0.3.1, 7.0.4, 7.0.5, 7.1.0, 7.1.1, 7.1.2]
# Exclude combinations that are not supported.
exclude:
- ruby: 3.0
Expand Down
4 changes: 1 addition & 3 deletions acceptance/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

VERSION_7_1_0 = Gem::Version.create('7.1.0')

gem "minitest"
require "minitest/autorun"
require "minitest/focus"
Expand All @@ -17,7 +15,7 @@
require "activerecord-spanner-adapter"
require "active_record/connection_adapters/spanner_adapter"
require "securerandom"
require "composite_primary_keys" if ActiveRecord::gem_version < VERSION_7_1_0
require "composite_primary_keys" if ActiveRecord::gem_version < Gem::Version.create('7.1.0')

# rubocop:disable Style/GlobalVars

Expand Down
8 changes: 7 additions & 1 deletion lib/activerecord_spanner_adapter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class TableMetadata # :nodoc:
end

class Base
VERSION_7_1 = Gem::Version.create('7.1.0')

# Creates an object (or multiple objects) and saves it to the database. This method will use mutations instead
# of DML if there is no active transaction, or if the active transaction has been created with the option
# isolation: :buffered_mutations.
Expand Down Expand Up @@ -60,7 +62,10 @@ def self._insert_record values, returning = []
else
im = arel_table.compile_insert _substitute_values(values)
end
[connection.insert(im, "#{self} Create", primary_key || false, primary_key_value)]
result = connection.insert(im, "#{self} Create", primary_key || false, primary_key_value)

return result if ActiveRecord::gem_version < VERSION_7_1
[result]
end

def self._upsert_record values
Expand Down Expand Up @@ -135,6 +140,7 @@ def self._buffer_record values, method

connection.current_spanner_transaction.buffer mutation

return primary_key_value if ActiveRecord::gem_version < VERSION_7_1
[primary_key_value]
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require_relative "../mock_server/spanner_mock_server"
require_relative "../test_helper"

return if ActiveRecord::gem_version >= VERSION_7_1_0
return if ActiveRecord::gem_version >= Gem::Version.create('7.1.0')

require_relative "models/singer"
require_relative "models/album"
Expand Down
4 changes: 1 addition & 3 deletions test/activerecord_spanner_interleaved_table/model_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
#
# frozen_string_literal: true

VERSION_7_1_0 = Gem::Version.create('7.1.0')

require_relative "../mock_server/spanner_mock_server"
require_relative "../test_helper"

return if ActiveRecord::gem_version >= VERSION_7_1_0
return if ActiveRecord::gem_version >= Gem::Version.create('7.1.0')

require_relative "models/singer"
require_relative "models/album"
Expand Down

0 comments on commit 05167d8

Please sign in to comment.