Skip to content

Always use GDK Gitaly version for gitaly test setup

What does this MR do?

Always use GDK Gitaly version for gitaly test setup

This is the version which the gitaly binary was compiled, and this avoids the problem where we try to get a version which is not yet fetched from origin.

We keep the warning where the binary's version does not match the version in GITALY_SERVER_VERSION.

Related issue: !67729 (closed), #337921 (closed)

Scenarios

  1. tmp/tests/gitaly does not exist, and GITALY_SERVER_VERSION is behind GDK Gitaly's version
$ ss spec/models/clusters/agent_spec.rb:10
Running via Spring preloader in process 96941
warning: parser/current is loading parser/ruby27, which recognizes
warning: 2.7.2-compliant syntax, but you are running 2.7.4.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Run options: include {:focus=>true, :locations=>{"./spec/models/clusters/agent_spec.rb"=>[10]}}
WARNING: Gitaly, version 14.3.0-rc1-78-g50eff62c1 does not exactly match repository version 6115d790a6ab9750b1eb1285c2fe88ea04ec82d3
==> Gitaly set up in 39.933132 seconds...

Test environment set up in 52.024237 seconds
.

Finished in 58.47 seconds (files took 5.18 seconds to load)
1 example, 0 failures
  1. tmp/tests/gitaly repo version is behind GDK Gitaly's version. The test repo is re-created
$ ss spec/models/clusters/agent_spec.rb:10
Running via Spring preloader in process 98273
warning: parser/current is loading parser/ruby27, which recognizes
warning: 2.7.2-compliant syntax, but you are running 2.7.4.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Run options: include {:focus=>true, :locations=>{"./spec/models/clusters/agent_spec.rb"=>[10]}}
==> Gitaly set up in 42.902368 seconds...

Test environment set up in 54.404877 seconds
.

Finished in 1 minute 0.71 seconds (files took 4.94 seconds to load)
1 example, 0 failures
  1. GITALY_SERVER_VERSION is not present in GDK Gitaly's fetch history (e.g. because we git pull without gdk update)

**It's really hard to fake this with a fake SHA, But we can see below that we have a different error message now (no more not our ref). I will have to wait until https://gitlab.com/gitlab-org/gitlab/-/blob/master/GITALY_SERVER_VERSION gets updated later today to test this.

$ ss spec/models/clusters/agent_spec.rb:10
Running via Spring preloader in process 98517
warning: parser/current is loading parser/ruby27, which recognizes
warning: 2.7.2-compliant syntax, but you are running 2.7.4.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Run options: include {:focus=>true, :locations=>{"./spec/models/clusters/agent_spec.rb"=>[10]}}
/Users/tkuah/code/ee-gdk/gitlab/tmp/tests/gitaly/ruby/Gemfile does not exist.

An error occurred in a `before(:suite)` hook.
Failure/Error: raise message

RuntimeError:
  gitaly spawn failed (try `rm -rf tmp/tests/gitaly` ?)
# ./spec/support/helpers/test_env.rb:214:in `block in start_gitaly'
# ./spec/support/helpers/test_env.rb:210:in `start_gitaly'
# ./spec/support/helpers/test_env.rb:131:in `post_init'
# ./ee/spec/support/helpers/ee/test_env.rb:14:in `post_init'
# ./spec/support/helpers/test_env.rb:124:in `init'
# ./spec/spec_helper.rb:215:in `block (2 levels) in <main>'
# -e:1:in `<main>'


Finished in 4.39 seconds (files took 6.49 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples
Edited by Thong Kuah

Merge request reports

Loading