Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
GitLab
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
需求
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
测试用例
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
洞察
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
gitlab-cn
GitLab
提交
ee844c79
提交
ee844c79
编辑于
1 year ago
作者:
Manoj M J
提交者:
Dylan Griffith
1 year ago
浏览文件
操作
下载
补丁
差异文件
Modify helper to fetch more details of BBM
上级
b9f3a984
No related branches found
No related tags found
无相关合并请求
变更
2
隐藏空白变更内容
行内
左右并排
显示
2 个更改的文件
keeps/helpers/postgres_ai.rb
+13
-1
13 个添加, 1 个删除
keeps/helpers/postgres_ai.rb
spec/keeps/helpers/postgres_ai_spec.rb
+23
-1
23 个添加, 1 个删除
spec/keeps/helpers/postgres_ai_spec.rb
有
36 个添加
和
2 个删除
keeps/helpers/postgres_ai.rb
+
13
−
1
浏览文件 @
ee844c79
...
@@ -11,7 +11,8 @@ def initialize
...
@@ -11,7 +11,8 @@ def initialize
def
fetch_background_migration_status
(
job_class_name
)
def
fetch_background_migration_status
(
job_class_name
)
query
=
<<~
SQL
query
=
<<~
SQL
SELECT id, created_at, updated_at, finished_at, started_at, status, job_class_name, gitlab_schema
SELECT id, created_at, updated_at, finished_at, started_at, status, job_class_name,
gitlab_schema, total_tuple_count
FROM batched_background_migrations
FROM batched_background_migrations
WHERE job_class_name = $1::text
WHERE job_class_name = $1::text
SQL
SQL
...
@@ -19,6 +20,17 @@ def fetch_background_migration_status(job_class_name)
...
@@ -19,6 +20,17 @@ def fetch_background_migration_status(job_class_name)
pg_client
.
exec_params
(
query
,
[
job_class_name
])
pg_client
.
exec_params
(
query
,
[
job_class_name
])
end
end
def
fetch_migrated_tuple_count
(
batched_background_migration_id
)
query
=
<<~
SQL
SELECT SUM("batched_background_migration_jobs"."batch_size")
FROM "batched_background_migration_jobs"
WHERE "batched_background_migration_jobs"."batched_background_migration_id" =
#{
batched_background_migration_id
}
AND ("batched_background_migration_jobs"."status" IN (3))
SQL
pg_client
.
exec_params
(
query
)
end
private
private
def
connection_string
def
connection_string
...
...
此差异已折叠。
点击以展开。
spec/keeps/helpers/postgres_ai_spec.rb
+
23
−
1
浏览文件 @
ee844c79
...
@@ -39,7 +39,8 @@
...
@@ -39,7 +39,8 @@
let
(
:job_class_name
)
{
'ExampleJob'
}
let
(
:job_class_name
)
{
'ExampleJob'
}
let
(
:query
)
do
let
(
:query
)
do
<<~
SQL
<<~
SQL
SELECT id, created_at, updated_at, finished_at, started_at, status, job_class_name, gitlab_schema
SELECT id, created_at, updated_at, finished_at, started_at, status, job_class_name,
gitlab_schema, total_tuple_count
FROM batched_background_migrations
FROM batched_background_migrations
WHERE job_class_name = $1::text
WHERE job_class_name = $1::text
SQL
SQL
...
@@ -54,4 +55,25 @@
...
@@ -54,4 +55,25 @@
expect
(
result
).
to
eq
(
query_response
)
expect
(
result
).
to
eq
(
query_response
)
end
end
end
end
describe
'#fetch_migrated_tuple_count'
do
let
(
:batched_background_migration_id
)
{
100
}
let
(
:query
)
do
<<~
SQL
SELECT SUM("batched_background_migration_jobs"."batch_size")
FROM "batched_background_migration_jobs"
WHERE "batched_background_migration_jobs"."batched_background_migration_id" = 100
AND ("batched_background_migration_jobs"."status" IN (3))
SQL
end
let
(
:query_response
)
{
double
}
subject
(
:result
)
{
described_class
.
new
.
fetch_migrated_tuple_count
(
batched_background_migration_id
)
}
it
'fetches data from Postgres AI'
do
expect
(
pg_client
).
to
receive
(
:exec_params
).
with
(
query
).
and_return
(
query_response
)
expect
(
result
).
to
eq
(
query_response
)
end
end
end
end
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录