Fix: failed uint test due to cache
This commit is contained in:
parent
ca07a94d41
commit
8557ed8e2e
3 changed files with 5 additions and 2 deletions
|
@ -44,7 +44,7 @@ func TestFolder_GetChildFile(t *testing.T) {
|
|||
asserts.NoError(mock.ExpectationsWereMet())
|
||||
asserts.NoError(err)
|
||||
asserts.Equal("1.txt", file.Name)
|
||||
asserts.Equal("/1.txt", file.Position)
|
||||
asserts.Equal("/", file.Position)
|
||||
}
|
||||
|
||||
// 不存在
|
||||
|
|
|
@ -83,6 +83,7 @@ func TestFileSystem_GetContent(t *testing.T) {
|
|||
asserts.NoError(err)
|
||||
_ = file.Close()
|
||||
|
||||
cache.Deletes([]string{"1"}, "policy_")
|
||||
mock.ExpectQuery("SELECT(.+)").
|
||||
WithArgs(1).
|
||||
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(1))
|
||||
|
@ -95,6 +96,7 @@ func TestFileSystem_GetContent(t *testing.T) {
|
|||
fs.CleanTargets()
|
||||
|
||||
// 打开文件失败
|
||||
cache.Deletes([]string{"1"}, "policy_")
|
||||
mock.ExpectQuery("SELECT(.+)").
|
||||
WithArgs(1).
|
||||
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(1))
|
||||
|
@ -107,6 +109,7 @@ func TestFileSystem_GetContent(t *testing.T) {
|
|||
fs.CleanTargets()
|
||||
|
||||
// 打开成功
|
||||
cache.Deletes([]string{"1"}, "policy_")
|
||||
mock.ExpectQuery("SELECT(.+)").
|
||||
WithArgs(1).
|
||||
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(1))
|
||||
|
|
|
@ -148,5 +148,5 @@ func TestFileSystem_IsChildFileExist(t *testing.T) {
|
|||
exist, childFile := fs.IsChildFileExist(&folder, "321")
|
||||
asserts.NoError(mock.ExpectationsWereMet())
|
||||
asserts.True(exist)
|
||||
asserts.Equal("/123/321", childFile.Position)
|
||||
asserts.Equal("/123", childFile.Position)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue