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

Feature/oracle #1869

Merged
merged 13 commits into from
May 25, 2022
Merged

Feature/oracle #1869

merged 13 commits into from
May 25, 2022

Conversation

wenzi1
Copy link
Member

@wenzi1 wenzi1 commented May 20, 2022

1.更换oracle驱动
2. 增加oracle单元测试
3. 修改mssql单元测试
4. ci中增加oracle镜像,oracle driver只在1.17上执行

@codecov-commenter
Copy link

codecov-commenter commented May 20, 2022

Codecov Report

Merging #1869 (24667e0) into master (07509e9) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1869      +/-   ##
==========================================
- Coverage   73.24%   73.23%   -0.02%     
==========================================
  Files         503      503              
  Lines       45392    45479      +87     
==========================================
+ Hits        33249    33305      +56     
- Misses      10116    10143      +27     
- Partials     2027     2031       +4     
Flag Coverage Δ
go-1.15-386 ?
go-1.15-amd64 73.20% <100.00%> (+<0.01%) ⬆️
go-1.16-386 73.17% <100.00%> (-0.01%) ⬇️
go-1.16-amd64 ?
go-1.17-386 ?
go-1.17-amd64 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
contrib/drivers/mysql/mysql.go 64.34% <ø> (ø)
contrib/drivers/mssql/mssql.go 85.89% <100.00%> (+0.06%) ⬆️
database/gdb/gdb_core_underlying.go 75.26% <100.00%> (ø)
database/gdb/gdb_model_update.go 73.75% <0.00%> (-7.50%) ⬇️
os/gfsnotify/gfsnotify_watcher_loop.go 78.15% <0.00%> (-6.73%) ⬇️
database/gdb/gdb_core_structure.go 63.52% <0.00%> (+1.17%) ⬆️
contrib/drivers/clickhouse/clickhouse.go 69.62% <0.00%> (+3.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7753fc6...24667e0. Read the comment docs.

fields[m["Field"].String()] = &gdb.TableField{
Index: i,
Name: m["Field"].String(),
Type: m["Type"].String(),
Null: m["Null"].Bool(),
Null: isNull,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用m["Null"].Bool()会有什么问题吗?

if reflect.TypeOf(v).Kind() == reflect.String {
valueStr := gconv.String(v)
if gregex.IsMatchString(`^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$`, valueStr) {
// args[i] = fmt.Sprintf(`TO_DATE('%s','yyyy-MM-dd HH:MI:SS')`, valueStr)
args[i], _ = time.ParseInLocation("2006-01-02 15:04:05", valueStr, time.Local)
}
}
}
}*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果确定不需要,那么请删除,而不是注释。

Name: strings.ToLower(m["FIELD"].String()),
Type: strings.ToLower(m["TYPE"].String()),
Name: m["FIELD"].String(),
Type: m["TYPE"].String(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

拿不到Comment等其他信息吗?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个表里查不到

gtest.AssertEQ(ok, true)

gtest.AssertEQ(res[k].Name, k)
gtest.Assert(res[k].Type, v)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

少了其他属性的断言,拿不到其他信息吗?

func TestFilteredLink(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
s := db.FilteredLink()
gtest.AssertEQ(s, "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

缺少Link配置,以便使得FilteredLink方法生效,这样才能返回结果,再执行断言。

gtest.C(t, func(t *gtest.T) {
_, err := dbErr.Query(ctx, "select 1 from dual")
gtest.AssertNE(err, nil)
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对于FilteredLink方法的单例来讲,这两个SELECT的case似乎没什么意义?

contrib/drivers/oracle/oracle_z_basic_test.go Show resolved Hide resolved
}
})

}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个只是个工具方法,并不是单测,并且不能和上面的单测原子执行。
写单测,需要保证单测的每个case结束完毕后,不会污染环境。
如果oracle有默认生成的日志文件的话,建议通过配置取消掉。

@gqcn gqcn added the wip label May 23, 2022
@gqcn gqcn merged commit ef04c8a into gogf:master May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants