Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

modify cache_test for issues #330 #634

Closed
wants to merge 1 commit into from

Conversation

mamoroom
Copy link
Contributor

@mamoroom mamoroom commented Jul 4, 2017

PK should be defined for hitting cache.
In this test, only the function "TestCacheFind2" will return wrong error.
5b65f21

[xorm] [info]  2017/07/05 00:14:32.340455 [SQL] SELECT `id`, `username`, `password` FROM `mail_box2` WHERE `id` IN (?,?) [0 1]
[xorm] [debug] 2017/07/05 00:14:32.340568 [cacheFind] cache bean:mail_box2[0] &{0 user1 pass1} [0xc42001bd10 <nil>]
[xorm] [debug] 2017/07/05 00:14:32.340579 [cacheFind] cache bean:mail_box2[1] &{1 user2 pass2} [0xc42001bd38 <nil>]
[xorm] [warn]  2017/07/05 00:14:32.340583 [cacheFind] cache no hit:mail_box2[1] [0xc42001bd38 <nil>]
--- FAIL: TestCacheFind2 (0.00s)
        Error Trace:    cache_test.go:95
        Error:          Not equal: 2 (expected)
                                != 1 (actual)

        Error Trace:    cache_test.go:97
        Error:          Not equal: 0x0 (expected)
                                != 0x1 (actual)

        Error Trace:    cache_test.go:98
        Error:          Not equal: "user1" (expected)
                                != "user2" (actual)

        Error Trace:    cache_test.go:99
        Error:          Not equal: "pass1" (expected)
                                != "pass2" (actual)

        Error Trace:    cache_test.go:104
        Error:          Not equal: 2 (expected)
                                != 1 (actual)

        Error Trace:    cache_test.go:106
        Error:          Not equal: 0x0 (expected)
                                != 0x1 (actual)

        Error Trace:    cache_test.go:107
        Error:          Not equal: "user1" (expected)
                                != "user2" (actual)

        Error Trace:    cache_test.go:108
        Error:          Not equal: "pass1" (expected)
                                != "pass2" (actual)

FAIL
exit status 1
FAIL    github.com/mamoroom/xorm        0.091s

@mamoroom mamoroom mentioned this pull request Jul 4, 2017
@lunny lunny added this to the 0.7 milestone Jul 5, 2017
@lunny lunny added the testing label Jul 5, 2017
@lunny
Copy link
Member

lunny commented Jul 5, 2017

@mamoroom The change is no need. Id int64 will be recognized by xorm as primary key and auctonicrment.

@mamoroom
Copy link
Contributor Author

mamoroom commented Jul 5, 2017

@lunny I don't think so. I got different records when I add pk tag in table struct. Then, I got wrong error results for cache getting.
Please execute and compare the result your testing and my testing.

@lunny
Copy link
Member

lunny commented Jul 5, 2017

Yes, I'm tracking the issue.

@mamoroom
Copy link
Contributor Author

mamoroom commented Jul 5, 2017

Just to be clear, there are some glitches caching uint64 pk's rows, right?
If you understand this case, I will try to resolve this problem.

@lunny
Copy link
Member

lunny commented Jul 5, 2017

Yes. I think you are right. It's uint64 pk case. Could you send a PR to resolve that?

@mamoroom
Copy link
Contributor Author

mamoroom commented Jul 5, 2017

Thanks.
To solve that, let me ask something.
Do you have any plan to support unsigned type?
I think an uint field in table struct should be defined as unsigned on Database(like mysql).
If you are already in the process of supporting unsigned type, I will resolve on that branch.
If not, I will resolve only this glitch on master branch.

@lunny
Copy link
Member

lunny commented Jul 5, 2017

@mamoroom Yes, I think we need uint on almost all databases except sqlite since it didn't support. But I haven't begin to do that. Maybe you can resolve this special thing at first. Thanks!

@mamoroom
Copy link
Contributor Author

mamoroom commented Jul 5, 2017

OK.
I don't know well about database features except mysql.
So as you say, it's better to fix this glitch at first.
Then I could collaborate new support if you want.

@lunny lunny removed this from the 0.7 milestone Jul 6, 2017
@lunny
Copy link
Member

lunny commented Jul 6, 2017

closed by #635

@lunny lunny closed this Jul 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants