Skip to content
代码片段 群组 项目
未验证 提交 d7ab4edd 编辑于 作者: Sangwoo Han's avatar Sangwoo Han 提交者: GitLab
浏览文件

Removed usage of cell_name

上级 3025c2da
No related branches found
No related tags found
无相关合并请求
显示
85 个添加77 个删除
......@@ -167,6 +167,7 @@ PATH
remote: vendor/gems/gitlab-topology-service-client
specs:
gitlab-topology-service-client (0.1)
google-protobuf (~> 3)
grpc
PATH
......
......@@ -727,8 +727,8 @@
{"name":"state_machines","version":"0.5.0","platform":"ruby","checksum":"23e6249d374a920b528dccade403518b4abbd83841a3e2c9ef13e6f1a009b102"},
{"name":"state_machines-activemodel","version":"0.8.0","platform":"ruby","checksum":"e932dab190d4be044fb5f9cab01a3ea0b092c5f113d4676c6c0a0d49bf738d2c"},
{"name":"state_machines-activerecord","version":"0.8.0","platform":"ruby","checksum":"072fb701b8ab03de0608297f6c55dc34ed096e556fa8f77e556f3c461c71aab6"},
{"name":"stringio","version":"3.1.2","platform":"java","checksum":"8a11a30ec257e6d9851a42dacb968b07a56bf2cfe359b2d906ec1f8774ac7d71"},
{"name":"stringio","version":"3.1.2","platform":"ruby","checksum":"204f1828f85cdb39d57cac4abc6dc44b04505a223f131587f2e20ae3729ba131"},
{"name":"stringio","version":"3.1.3","platform":"java","checksum":"c8602527d7c568e13d7097de97dd23c59302af13c3f7cdf6ace7af0f2d290efe"},
{"name":"stringio","version":"3.1.3","platform":"ruby","checksum":"1eedb8369ee99a9a0edfdacea95c72d647feb8ce844427c150bd641e1797abc8"},
{"name":"strings","version":"0.2.1","platform":"ruby","checksum":"933293b3c95cf85b81eb44b3cf673e3087661ba739bbadfeadf442083158d6fb"},
{"name":"strings-ansi","version":"0.2.0","platform":"ruby","checksum":"90262d760ea4a94cc2ae8d58205277a343409c288cbe7c29416b1826bd511c88"},
{"name":"swd","version":"2.0.3","platform":"ruby","checksum":"4cdbe2a4246c19f093fce22e967ec3ebdd4657d37673672e621bf0c7eb770655"},
......
......@@ -167,6 +167,7 @@ PATH
remote: vendor/gems/gitlab-topology-service-client
specs:
gitlab-topology-service-client (0.1)
google-protobuf (~> 3)
grpc
PATH
......@@ -1852,7 +1853,7 @@ GEM
state_machines-activerecord (0.8.0)
activerecord (>= 5.1)
state_machines-activemodel (>= 0.8.0)
stringio (3.1.2)
stringio (3.1.3)
strings (0.2.1)
strings-ansi (~> 0.2)
unicode-display_width (>= 1.5, < 3.0)
......
......@@ -18,11 +18,8 @@ def client
)
end
def cell_name
# This should be removed in
# https://gitlab.com/gitlab-com/gl-infra/tenant-scale/cells-infrastructure/team/-/issues/60
# then we should pass cell.id instead
@cell_name ||= "cell-#{Gitlab.config.cell.id}"
def cell_id
@cell_id ||= Gitlab.config.cell.id
end
def service_credentials
......
......@@ -6,10 +6,10 @@ module Gitlab
module TopologyServiceClient
class CellService < BaseService
def get_cell_info
response = client.get_cell(Gitlab::Cells::TopologyService::GetCellRequest.new(cell_name: cell_name))
response = client.get_cell(Gitlab::Cells::TopologyService::GetCellRequest.new(cell_id: cell_id))
response.cell_info
rescue GRPC::NotFound
Gitlab::AppLogger.error(message: "Cell '#{cell_name}' not found on Topology Service")
Gitlab::AppLogger.error(message: "Cell '#{cell_id}' not found on Topology Service")
nil
end
......
......@@ -8,7 +8,7 @@
let(:cell_info) do
Gitlab::Cells::TopologyService::CellInfo.new(
name: "cell-1",
id: 1,
address: "127.0.0.1:3000",
session_prefix: "cell-1-",
sequence_range: Gitlab::Cells::TopologyService::SequenceRange.new(minval: 1, maxval: 1000)
......@@ -33,7 +33,7 @@
it 'returns the cell information' do
expect_next_instance_of(service_class) do |instance|
expect(instance).to receive(:get_cell).with(
Gitlab::Cells::TopologyService::GetCellRequest.new(cell_name: "cell-1")
Gitlab::Cells::TopologyService::GetCellRequest.new(cell_id: 1)
).and_return(Gitlab::Cells::TopologyService::GetCellResponse.new(cell_info: cell_info))
end
......@@ -43,11 +43,11 @@
it 'returns nil if the cell is not found' do
expect_next_instance_of(service_class) do |instance|
expect(instance).to receive(:get_cell).with(
Gitlab::Cells::TopologyService::GetCellRequest.new(cell_name: "cell-1")
Gitlab::Cells::TopologyService::GetCellRequest.new(cell_id: 1)
).and_raise(GRPC::NotFound)
end
expected_error = "Cell 'cell-1' not found on Topology Service"
expected_error = "Cell '1' not found on Topology Service"
expect(Gitlab::AppLogger).to receive(:error).with(hash_including(message: expected_error))
expect(cell_service.get_cell_info).to be_nil
end
......
......@@ -2,72 +2,80 @@ PATH
remote: .
specs:
gitlab-topology-service-client (0.1)
google-protobuf (~> 3)
grpc
GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.3.2)
activesupport (8.0.1)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.8)
benchmark (0.4.0)
bigdecimal (3.1.9)
binding_of_caller (1.0.1)
debug_inspector (>= 1.2.0)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
debug_inspector (1.2.0)
diff-lcs (1.5.1)
drb (2.2.1)
gitlab-styles (10.1.0)
rubocop (~> 1.50.2)
rubocop-graphql (~> 0.18)
rubocop-performance (~> 1.15)
rubocop-rails (~> 2.17)
rubocop-rspec (~> 2.22)
google-protobuf (3.25.3)
googleapis-common-protos-types (1.14.0)
google-protobuf (~> 3.18)
grpc (1.63.0)
google-protobuf (~> 3.25)
gitlab-styles (13.0.2)
rubocop (~> 1.68.0)
rubocop-capybara (~> 2.21.0)
rubocop-factory_bot (~> 2.26.1)
rubocop-graphql (~> 1.5.4)
rubocop-performance (~> 1.21.1)
rubocop-rails (~> 2.26.0)
rubocop-rspec (~> 3.0.4)
rubocop-rspec_rails (~> 2.30.0)
google-protobuf (3.25.6)
googleapis-common-protos-types (1.18.0)
google-protobuf (>= 3.18, < 5.a)
grpc (1.69.0)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
i18n (1.14.5)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
json (2.7.1)
minitest (5.22.3)
mutex_m (0.2.0)
parallel (1.24.0)
parser (3.3.0.5)
json (2.9.1)
language_server-protocol (3.17.0.3)
logger (1.6.5)
minitest (5.25.4)
parallel (1.26.3)
parser (3.3.7.0)
ast (~> 2.4.1)
racc
proc_to_ast (0.2.0)
parser
rouge
unparser
racc (1.7.3)
rack (3.0.11)
racc (1.8.1)
rack (3.1.8)
rainbow (3.1.1)
regexp_parser (2.9.0)
rexml (3.2.6)
rouge (4.3.0)
regexp_parser (2.10.0)
rouge (4.5.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-parameterized (1.0.2)
......@@ -81,53 +89,53 @@ GEM
rspec-parameterized-table_syntax (1.0.1)
binding_of_caller
rspec-parameterized-core (< 2)
rspec-support (3.13.0)
rubocop (1.50.2)
rspec-support (3.13.2)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.20.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-graphql (0.19.0)
rubocop (>= 0.87, < 2)
rubocop-performance (1.20.2)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-graphql (1.5.4)
rubocop (>= 1.50, < 2)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.23.1)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.26.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rspec (2.29.2)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.3)
rubocop (~> 1.40)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.5)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
rubocop-rspec (~> 3, >= 3.0.1)
ruby-progressbar (1.13.0)
securerandom (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
unicode-display_width (2.6.0)
unparser (0.6.15)
diff-lcs (~> 1.3)
parser (>= 3.3.0)
uri (1.0.2)
PLATFORMS
ruby
DEPENDENCIES
gitlab-styles (~> 10.1.0)
gitlab-styles (~> 13.0.1)
gitlab-topology-service-client!
rspec (~> 3.0)
rspec-parameterized (~> 1.0.2)
......
d88ee3c1078fee452e03170cc74da0db5732c8a7
720d21b23a25d9571c225f2d737a18ff82907b8f
......@@ -16,8 +16,9 @@ Gem::Specification.new do |spec|
spec.files = Dir["lib/**/*.rb"]
spec.require_paths = ["lib"]
spec.add_dependency "google-protobuf", "~> 3"
spec.add_dependency "grpc"
spec.add_development_dependency "gitlab-styles", "~> 10.1.0"
spec.add_development_dependency "gitlab-styles", "~> 13.0.1"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rspec-parameterized", "~> 1.0.2"
spec.add_development_dependency "rubocop", "~> 1.21"
......
......@@ -11,7 +11,6 @@
end
add_message "gitlab.cells.topology_service.CellInfo" do
optional :id, :int64, 1, json_name: "id"
optional :name, :string, 2, json_name: "name"
optional :address, :string, 3, json_name: "address"
optional :session_prefix, :string, 4, json_name: "sessionPrefix"
optional :sequence_range, :message, 5, "gitlab.cells.topology_service.SequenceRange", json_name: "sequenceRange"
......
......@@ -8,7 +8,7 @@
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("proto/cell_service.proto", :syntax => :proto3) do
add_message "gitlab.cells.topology_service.GetCellRequest" do
optional :cell_name, :string, 1, json_name: "cellName"
optional :cell_id, :int64, 2, json_name: "cellId"
end
add_message "gitlab.cells.topology_service.GetCellResponse" do
optional :cell_info, :message, 1, "gitlab.cells.topology_service.CellInfo", json_name: "cellInfo"
......
......@@ -23,6 +23,7 @@
value :UNSPECIFIED, 0
value :FIRST_CELL, 1
value :SESSION_PREFIX, 2
value :CELL_ID, 3
end
add_enum "gitlab.cells.topology_service.ClassifyAction" do
value :ACTION_UNSPECIFIED, 0
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册