Rails5 mysql fix milliseconds problem in pull request importer spec
What does this MR do?
Fix Rails 5 milliseconds problem in spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb
. This happened (sometimes) when running RAILS5=1 bin/rspec spec/lib/banzai/object_renderer_spec.rb spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb:129
which was failing with
1) Gitlab::GithubImport::Importer::PullRequestsImporter#each_object_to_import yields every pull request to the supplied block
Failure/Error: raise Error, e
Gitlab::Shell::Error:
5:GetRepoPath: not a git repository '/builds/jlemaes/gitlab-ce/tmp/tests/repositories/@hashed/fc/71/fc71f2d6d38dbfc752ecaf2262916dc8ad99a34243d47b34691f9f8a3afaeffd.git'
# ./lib/gitlab/shell.rb:455:in `rescue in gitaly_migrate'
# ./lib/gitlab/shell.rb:450:in `gitaly_migrate'
# ./lib/gitlab/shell.rb:136:in `fetch_remote'
# ./app/models/repository.rb:884:in `fetch_remote'
# ./lib/gitlab/github_import/importer/pull_requests_importer.rb:39:in `update_repository'
# ./lib/gitlab/github_import/importer/pull_requests_importer.rb:27:in `block in each_object_to_import'
# ./lib/gitlab/github_import/parallel_scheduling.rb:99:in `block (2 levels) in each_object_to_import'
# ./lib/gitlab/github_import/parallel_scheduling.rb:96:in `each'
# ./lib/gitlab/github_import/parallel_scheduling.rb:96:in `block in each_object_to_import'
# ./lib/gitlab/github_import/parallel_scheduling.rb:86:in `each_object_to_import'
# ./lib/gitlab/github_import/importer/pull_requests_importer.rb:26:in `each_object_to_import'
# ./spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb:130:in `block (4 levels) in <top (required)>'
# ./spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb:130:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:152:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# GRPC::NotFound:
# 5:GetRepoPath: not a git repository '/builds/jlemaes/gitlab-ce/tmp/tests/repositories/@hashed/fc/71/fc71f2d6d38dbfc752ecaf2262916dc8ad99a34243d47b34691f9f8a3afaeffd.git'
# ./lib/gitlab/gitaly_client.rb:134:in `call'
See https://gitlab.com/jlemaes/gitlab-ce/-/jobs/80149368
It was caused by this line: https://gitlab.com/gitlab-org/gitlab-ce/blob/16d92de1e2ef5c187f7826c5a15fbc2121273dde/lib/gitlab/github_import/importer/pull_requests_importer.rb#L52 not returning false, because the MySQL milliseconds problem(#48430 (closed)). Fixed by forcing the imported PR to be created 1 second ago.
Are there points in the code the reviewer needs to double check?
Why was this MR needed?
rails5 upgrade
Screenshots (if relevant)
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Conform by the code review guidelines
-
Has been reviewed by a UX Designer -
Has been reviewed by a Frontend maintainer -
Has been reviewed by a Backend maintainer -
Has been reviewed by a Database specialist
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Conform by the database guides -
If you have multiple commits, please combine them into a few logically organized commits by squashing them -
Internationalization required/considered -
End-to-end tests pass ( package-and-qa
manual pipeline job)