Description
The test introduced in #6389 fails if the key already exists.
For instance, this fails for SQLite on a second run if the database is not deleted.
Failure: https://github.com/go-gorm/gorm/blob/206613868439c5ee7e62e116a46503eddf55a548/tests/error_translator_test.go#L53
Database created here, survives over multiple runs: https://github.com/go-gorm/gorm/blob/206613868439c5ee7e62e116a46503eddf55a548/tests/tests_test.go#L92
It passes in CI because os.TempDir is reset between runs.
Comment From: github-actions[bot]
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking ✨
Comment From: ncruces
Steps to reproduce:
git clone https://github.com/go-gorm/gorm.git
cd gorm/tests
echo "update SQLite driver to support error translation"
go get -u gorm.io/driver/sqlite
go mod tidy
echo "delete the db if it exists"
rm -f $TMPDIR/gorm.db
echo "first run passes, count=1 avoids caching"
go test . -count=1
echo "second run fails, count=1 avoids caching"
go test . -count=1
Comment From: github-actions[bot]
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking ✨
Comment From: saeidee
Thanks for pointing it out @ncruces, this PR has the fixes https://github.com/go-gorm/gorm/pull/6403.
Comment From: github-actions[bot]
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking ✨