Skip to content

Commit

Permalink
chore(bigtable): Update minitest to 5.14
Browse files Browse the repository at this point in the history
* Add rubocop-minitest
* Run bundle exec rubocop --only Minitest/GlobalExpectations -a
  * 127 files inspected, 1349 offenses detected, 1349 offenses corrected
* Revert rubocop-minitest
* Manually fix broken expectations in test stubs
* Manually fix broken raises expectations in unit tests
* Manually fix broken raises expectations in acceptance tests

refs: #4110
refs: #4116
pr:  #5688
  • Loading branch information
quartzmo authored Apr 23, 2020
1 parent d2bd9ab commit dbc5e20
Show file tree
Hide file tree
Showing 76 changed files with 1,404 additions and 1,403 deletions.
4 changes: 0 additions & 4 deletions google-cloud-bigtable/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ gem "google-cloud-errors", path: "../google-cloud-errors"

gem "minitest-reporters", "~> 1.3.5", require: false
gem "rake"

# Pin minitest to 5.11.x to avoid warnings emitted by 5.12.
# See https://github.com/googleapis/google-cloud-ruby/issues/4110
gem "minitest", "~> 5.11.3"
52 changes: 26 additions & 26 deletions google-cloud-bigtable/acceptance/bigtable/app_profile_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
app_profile_id = "default"

app_profiles = instance.app_profiles.to_a
app_profiles.wont_be :empty?
_(app_profiles).wont_be :empty?
app_profiles.each do |profile|
profile.must_be_kind_of Google::Cloud::Bigtable::AppProfile
_(profile).must_be_kind_of Google::Cloud::Bigtable::AppProfile
end

app_profile = instance.app_profile(app_profile_id)
app_profile.must_be_kind_of Google::Cloud::Bigtable::AppProfile
_(app_profile).must_be_kind_of Google::Cloud::Bigtable::AppProfile
end

it "create multi cluster routing app profile and delete" do
app_profile_id = "multi-cluster-#{Time.now.to_i}"
routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing
routing_policy.must_be_instance_of Google::Cloud::Bigtable::MultiClusterRoutingUseAny
_(routing_policy).must_be_instance_of Google::Cloud::Bigtable::MultiClusterRoutingUseAny

app_profile = instance.create_app_profile(
app_profile_id,
Expand All @@ -45,15 +45,15 @@
ignore_warnings: true
)

app_profile.must_be_kind_of Google::Cloud::Bigtable::AppProfile
app_profile.single_cluster_routing.must_be :nil?
app_profile.multi_cluster_routing.must_be_instance_of Google::Cloud::Bigtable::MultiClusterRoutingUseAny
_(app_profile).must_be_kind_of Google::Cloud::Bigtable::AppProfile
_(app_profile.single_cluster_routing).must_be :nil?
_(app_profile.multi_cluster_routing).must_be_instance_of Google::Cloud::Bigtable::MultiClusterRoutingUseAny

app_profile = instance.app_profile(app_profile_id)
app_profile.must_be_kind_of Google::Cloud::Bigtable::AppProfile
_(app_profile).must_be_kind_of Google::Cloud::Bigtable::AppProfile
app_profile.delete(ignore_warnings: true)

instance.app_profile(app_profile_id).must_be :nil?
_(instance.app_profile(app_profile_id)).must_be :nil?
end

it "create single cluster routing app profile and delete" do
Expand All @@ -62,27 +62,27 @@
bigtable_cluster_id,
allow_transactional_writes: true
)
routing_policy.must_be_instance_of Google::Cloud::Bigtable::SingleClusterRouting
routing_policy.cluster_id.must_equal bigtable_cluster_id
routing_policy.allow_transactional_writes.must_equal true
_(routing_policy).must_be_instance_of Google::Cloud::Bigtable::SingleClusterRouting
_(routing_policy.cluster_id).must_equal bigtable_cluster_id
_(routing_policy.allow_transactional_writes).must_equal true

app_profile = instance.create_app_profile(
app_profile_id,
routing_policy,
description: "App profile test single cluster routing",
ignore_warnings: true
)
app_profile.must_be_kind_of Google::Cloud::Bigtable::AppProfile
app_profile.multi_cluster_routing.must_be :nil?
app_profile.single_cluster_routing.must_be_instance_of Google::Cloud::Bigtable::SingleClusterRouting
app_profile.single_cluster_routing.cluster_id.must_equal bigtable_cluster_id
app_profile.single_cluster_routing.allow_transactional_writes.must_equal true
_(app_profile).must_be_kind_of Google::Cloud::Bigtable::AppProfile
_(app_profile.multi_cluster_routing).must_be :nil?
_(app_profile.single_cluster_routing).must_be_instance_of Google::Cloud::Bigtable::SingleClusterRouting
_(app_profile.single_cluster_routing.cluster_id).must_equal bigtable_cluster_id
_(app_profile.single_cluster_routing.allow_transactional_writes).must_equal true

app_profile = instance.app_profile(app_profile_id)
app_profile.must_be_kind_of Google::Cloud::Bigtable::AppProfile
_(app_profile).must_be_kind_of Google::Cloud::Bigtable::AppProfile
app_profile.delete(ignore_warnings: true)

instance.app_profile(app_profile_id).must_be :nil?
_(instance.app_profile(app_profile_id)).must_be :nil?
end

it "update app profile routing policy" do
Expand All @@ -98,20 +98,20 @@
description: "App profile test single cluster routing",
ignore_warnings: true
)
app_profile.must_be_kind_of Google::Cloud::Bigtable::AppProfile
app_profile.multi_cluster_routing.must_be :nil?
app_profile.single_cluster_routing.must_be_instance_of Google::Cloud::Bigtable::SingleClusterRouting
_(app_profile).must_be_kind_of Google::Cloud::Bigtable::AppProfile
_(app_profile.multi_cluster_routing).must_be :nil?
_(app_profile.single_cluster_routing).must_be_instance_of Google::Cloud::Bigtable::SingleClusterRouting

app_profile.routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing
job = app_profile.save(ignore_warnings: true)
job.wait_until_done!
job.app_profile.must_be_kind_of Google::Cloud::Bigtable::AppProfile
_(job.app_profile).must_be_kind_of Google::Cloud::Bigtable::AppProfile

app_profile.reload!
app_profile.single_cluster_routing.must_be :nil?
app_profile.multi_cluster_routing.must_be_instance_of Google::Cloud::Bigtable::MultiClusterRoutingUseAny
_(app_profile.single_cluster_routing).must_be :nil?
_(app_profile.multi_cluster_routing).must_be_instance_of Google::Cloud::Bigtable::MultiClusterRoutingUseAny

app_profile.delete(ignore_warnings: true)
instance.app_profile(app_profile_id).must_be :nil?
_(instance.app_profile(app_profile_id)).must_be :nil?
end
end
16 changes: 8 additions & 8 deletions google-cloud-bigtable/acceptance/bigtable/cluster_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

it "lists and get cluster" do
clusters = instance.clusters.to_a
clusters.wont_be :empty?
_(clusters).wont_be :empty?
clusters.each do |cluster|
cluster.must_be_kind_of Google::Cloud::Bigtable::Cluster
_(cluster).must_be_kind_of Google::Cloud::Bigtable::Cluster
end

cluster_id = clusters.first.cluster_id
first_cluster = instance.cluster(cluster_id)
first_cluster.must_be_kind_of Google::Cloud::Bigtable::Cluster
_(first_cluster).must_be_kind_of Google::Cloud::Bigtable::Cluster
end

it "create cluster, update and delete" do
Expand All @@ -40,20 +40,20 @@
job.wait_until_done!

clusters = instance.clusters.to_a
clusters.length.must_equal 2
_(clusters.length).must_equal 2

cluster = job.cluster
cluster.must_be_kind_of Google::Cloud::Bigtable::Cluster
instance.cluster(cluster_id).wont_be :nil?
_(cluster).must_be_kind_of Google::Cloud::Bigtable::Cluster
_(instance.cluster(cluster_id)).wont_be :nil?

cluster.nodes = 5
job = cluster.save
job.wait_until_done!

cluster = instance.cluster(cluster_id)
cluster.nodes.must_equal 5
_(cluster.nodes).must_equal 5

cluster.delete
instance.cluster(cluster_id).must_be :nil?
_(instance.cluster(cluster_id)).must_be :nil?
end if ENV["BIGTABLE_ALL_ACCEPTANCE_TESTS"]
end
112 changes: 56 additions & 56 deletions google-cloud-bigtable/acceptance/bigtable/column_family_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@
end

cf = column_families["cfcreate"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.name.must_equal "cfcreate"
cf.gc_rule.wont_be :nil?
cf.gc_rule.max_versions.must_equal 1
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.name).must_equal "cfcreate"
_(cf.gc_rule).wont_be :nil?
_(cf.gc_rule.max_versions).must_equal 1

cf = table.column_families["cfcreate"] # was updated by table.column_families
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.name.must_equal "cfcreate"
cf.gc_rule.wont_be :nil?
cf.gc_rule.max_versions.must_equal 1
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.name).must_equal "cfcreate"
_(cf.gc_rule).wont_be :nil?
_(cf.gc_rule.max_versions).must_equal 1
end

it "adds a column family" do
Expand All @@ -57,16 +57,16 @@
end

cf = column_families["cfcreate"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.name.must_equal "cfcreate"
cf.gc_rule.wont_be :nil?
cf.gc_rule.max_versions.must_equal 1
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.name).must_equal "cfcreate"
_(cf.gc_rule).wont_be :nil?
_(cf.gc_rule.max_versions).must_equal 1

cf = table.column_families["cfcreate"] # was updated by table.column_families
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.name.must_equal "cfcreate"
cf.gc_rule.wont_be :nil?
cf.gc_rule.max_versions.must_equal 1
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.name).must_equal "cfcreate"
_(cf.gc_rule).wont_be :nil?
_(cf.gc_rule.max_versions).must_equal 1
end

it "adds a column family without gc_rule" do
Expand All @@ -75,14 +75,14 @@
end

cf = column_families["cfcreate"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.name.must_equal "cfcreate"
cf.gc_rule.must_be :nil?
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.name).must_equal "cfcreate"
_(cf.gc_rule).must_be :nil?

cf = table.column_families["cfcreate"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.name.must_equal "cfcreate"
cf.gc_rule.must_be :nil?
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.name).must_equal "cfcreate"
_(cf.gc_rule).must_be :nil?
end

it "updates a column family" do
Expand All @@ -93,40 +93,40 @@
end

cf = column_families["cf1"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.gc_rule.max_age.must_equal 300
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.gc_rule.max_age).must_equal 300

cf = table.column_families["cf1"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.gc_rule.max_age.must_equal 300
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.gc_rule.max_age).must_equal 300
end

it "updates a column family without gc_rule" do
cf = table.column_families["cf1"]
cf.gc_rule.wont_be :nil?
_(cf.gc_rule).wont_be :nil?

column_families = table.column_families do |cfs|
cfs.update "cf1"
end

cf = column_families["cf1"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.gc_rule.must_be :nil?
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.gc_rule).must_be :nil?

cf = table.column_families["cf1"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.gc_rule.must_be :nil?
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.gc_rule).must_be :nil?
end

it "deletes a column family" do
table.column_families["cf2"].wont_be :nil?
_(table.column_families["cf2"]).wont_be :nil?

column_families = table.column_families do |cfs|
cfs.delete "cf2"
end

column_families["cf2"].must_be :nil?
table.column_families["cf2"].must_be :nil?
_(column_families["cf2"]).must_be :nil?
_(table.column_families["cf2"]).must_be :nil?
end

it "adds a column family with union gc rules" do
Expand All @@ -139,20 +139,20 @@
end

cf = column_families["cfunion"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.name.must_equal "cfunion"
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.name).must_equal "cfunion"
rules = cf.gc_rule.union
rules.must_be_kind_of Array
rules.count.must_equal 2
rules[0].must_be_kind_of Google::Cloud::Bigtable::GcRule
rules[0].max_versions.must_equal 3
rules[1].must_be_kind_of Google::Cloud::Bigtable::GcRule
rules[1].max_age.must_equal 300
_(rules).must_be_kind_of Array
_(rules.count).must_equal 2
_(rules[0]).must_be_kind_of Google::Cloud::Bigtable::GcRule
_(rules[0].max_versions).must_equal 3
_(rules[1]).must_be_kind_of Google::Cloud::Bigtable::GcRule
_(rules[1].max_age).must_equal 300

cf = table.column_families["cfunion"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.name.must_equal "cfunion"
cf.gc_rule.union.count.must_equal 2
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.name).must_equal "cfunion"
_(cf.gc_rule.union.count).must_equal 2
end

it "adds a column family with intersection gc rules" do
Expand All @@ -167,19 +167,19 @@
end

cf = column_families["cfintersect"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.name.must_equal "cfintersect"
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.name).must_equal "cfintersect"
rules = cf.gc_rule.intersection
rules.must_be_kind_of Array
rules.count.must_equal 2
rules[0].must_be_kind_of Google::Cloud::Bigtable::GcRule
rules[0].max_versions.must_equal 1
rules[1].must_be_kind_of Google::Cloud::Bigtable::GcRule
rules[1].max_age.must_equal 600
_(rules).must_be_kind_of Array
_(rules.count).must_equal 2
_(rules[0]).must_be_kind_of Google::Cloud::Bigtable::GcRule
_(rules[0].max_versions).must_equal 1
_(rules[1]).must_be_kind_of Google::Cloud::Bigtable::GcRule
_(rules[1].max_age).must_equal 600

cf = table.column_families["cfintersect"]
cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
cf.name.must_equal "cfintersect"
cf.gc_rule.intersection.count.must_equal 2
_(cf).must_be_kind_of Google::Cloud::Bigtable::ColumnFamily
_(cf.name).must_equal "cfintersect"
_(cf.gc_rule.intersection.count).must_equal 2
end
end
Loading

0 comments on commit dbc5e20

Please sign in to comment.