Commit 861896c5 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

HGitaly RSpec tests for Blob/Tree in fully native mode

The tests are conditionally skipped according to the
HGitaly server version.

There *is* a small discrepancy: line ending in commit message,
but it doesn't actually lie in the code being tested, it should
be a comparison case in `FindCommit`.

Comparing with `HgGitRepository` is still useful for these
tests at this point, because there is some plumbery involved
on the Rails side for the HGitaly1 mode, and even in fully native
mode, it's good to check that nothing goes wrong. When the dust
settles on all this, though, it will be removable: actual thorough
comparisons are to be done in the testing code of HGitaly.

branch : heptapod
parent ea7d9baf84e2
Pipeline #20318 passed with stages
in 15 minutes and 8 seconds
......@@ -8,6 +8,17 @@
include RepoHelpers
include Gitlab::Popen
def skip_if_hgitaly_no_blob_tree
version = RSpec.configuration.hgitaly_version
# Gem version scheme understands the 'dev' scheme of Python PEP 440 somewhat:
# - an alphabetic part always means pre-release and is sorted lexicographically
# - the number after is taken into account
# so actually 'dev0' is greater that 'a1' and 'b1'. That's good enough for now, though.
if version <'0.12.0dev1')
skip "Skipped because HGitaly version #{version} does not implement blob/tree methods yet"
def hgitaly_repo_init
repo =
'default', 'hgitaly-repo.git', '', 'group/project')
......@@ -157,7 +168,7 @@ def hgitaly_repo_init
foo_last_commit = hgitaly_repo.list_last_commits_for_tree(
hg_commit_sha, 'foo')['foo']
expect( eq(root_hgsha)
expect(foo_last_commit.message).to eq("Commit 0\n")
expect(foo_last_commit.message.strip).to eq("Commit 0")
.to eq(hgitaly_repo)
......@@ -169,7 +180,7 @@ def hgitaly_repo_init
foo_git_last_commit = hg_git_repo.list_last_commits_for_tree(
git_commit_sha, 'foo')['foo']
expect( eq(root_gitsha)
expect(foo_git_last_commit.message).to eq("Commit 0\n")
expect(foo_git_last_commit.message.strip).to eq("Commit 0")
.to eq(hg_git_repo)
sub_foo1_git_last_commit = hg_git_repo.list_last_commits_for_tree(
......@@ -183,7 +194,16 @@ def hgitaly_repo_init
hgitaly_repo.is_hgitaly1 = true
it_behaves_like 'Blob/Tree basic integration'
it_behaves_like 'Blob/Tree common integration tests'
describe 'In fully native mode' do
before do
hgitaly_repo.is_hgitaly1 = false
it_behaves_like 'Blob/Tree common integration tests'
# Tell if two blobs have identical instance variables
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment