blob: be0d48e5ab9bb4250cd83fd6e703ed658162c8b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
describe 'SSH key support' do
# Note: If you run these tests against GDK make sure you've enabled sshd
# See: https://gitlab.com/gitlab-org/gitlab-qa/blob/master/docs/run_qa_against_gdk.md
let(:project) do
Resource::Project.fabricate! do |project|
project.name = 'ssh-tests'
end
end
before(:context) do
@key = Resource::SSHKey.fabricate_via_api! do |resource|
resource.title = "key for ssh tests #{Time.now.to_f}"
end
end
after(:context) do
@key.remove_via_api!
end
before do
Flow::Login.sign_in
end
it 'pushes code to the repository via SSH', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1283' do
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.ssh_key = @key
push.file_name = 'README.md'
push.file_content = '# Test Use SSH Key'
push.commit_message = 'Add README.md'
end.project.visit!
Page::Project::Show.perform do |project|
expect(project).to have_file('README.md')
expect(project).to have_readme_content('Test Use SSH Key')
end
end
it 'pushes multiple branches and tags together', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1282' do
branches = []
tags = []
Git::Repository.perform do |repository|
repository.uri = project.repository_ssh_location.uri
repository.use_ssh_key(@key)
repository.clone
repository.configure_identity('GitLab QA', 'root@gitlab.com')
1.upto(3) do |i|
branches << "branch#{i}"
tags << "tag#{i}"
repository.checkout("branch#{i}", new_branch: true)
repository.commit_file("file#{i}", SecureRandom.random_bytes(10000), "Add file#{i}")
repository.add_tag("tag#{i}")
end
repository.push_tags_and_branches(branches)
end
expect(project).to have_branches(branches)
expect(project).to have_tags(tags)
end
end
end
end
|