Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5fb6d9f7
Commit
5fb6d9f7
authored
Sep 21, 2021
by
Anastasia McDonald
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10io-qa-scenario-for-helm' into 'master'
Add helm QA scenario See merge request gitlab-org/gitlab!70507
parents
a2031fe5
94ed6312
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
220 additions
and
58 deletions
+220
-58
qa/qa/specs/features/browser_ui/5_package/helm_registry_spec.rb
...specs/features/browser_ui/5_package/helm_registry_spec.rb
+154
-0
qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb
...ures/browser_ui/5_package/maven_gradle_repository_spec.rb
+2
-58
qa/spec/spec_helper.rb
qa/spec/spec_helper.rb
+1
-0
qa/spec/support/shared_contexts/packages_registry_shared_context.rb
...pport/shared_contexts/packages_registry_shared_context.rb
+63
-0
No files found.
qa/qa/specs/features/browser_ui/5_package/helm_registry_spec.rb
0 → 100644
View file @
5fb6d9f7
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Package'
,
:orchestrated
,
:packages
,
:object_storage
,
quarantine:
{
only:
{
job:
'object_storage'
},
issue:
'https://gitlab.com/gitlab-org/gitlab/-/issues/341209'
,
type: :investigating
}
do
describe
'Helm Registry'
do
include
Runtime
::
Fixtures
include_context
'packages registry qa scenario'
let
(
:package_name
)
{
'gitlab_qa_helm'
}
let
(
:package_version
)
{
'1.3.7'
}
let
(
:package_type
)
{
'helm'
}
let
(
:package_gitlab_ci_file
)
do
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
deploy:
image: alpine:3
script:
- apk add helm --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
- apk add curl
- helm create
#{
package_name
}
- cp ./Chart.yaml
#{
package_name
}
- helm package
#{
package_name
}
- http_code=$(curl --write-out "%{http_code}" --request POST --form 'chart=@
#{
package_name
}
-
#{
package_version
}
.tgz' --user
#{
username
}
:
#{
access_token
}
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/stable/charts --output /dev/null --silent)
- '[ $http_code = "201" ]'
only:
- "
#{
package_project
.
default_branch
}
"
tags:
- "runner-for-
#{
package_project
.
group
.
name
}
"
YAML
}
end
let
(
:package_chart_yaml_file
)
do
{
file_path:
"Chart.yaml"
,
content:
<<~
EOF
apiVersion: v2
name:
#{
package_name
}
description: GitLab QA helm package
type: application
version:
#{
package_version
}
appVersion: "1.16.0"
EOF
}
end
let
(
:client_gitlab_ci_file
)
do
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
pull:
image: alpine:3
script:
- apk add helm --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
- helm repo add --username
#{
username
}
--password
#{
access_token
}
gitlab_qa ${CI_API_V4_URL}/projects/
#{
package_project
.
id
}
/packages/helm/stable
- helm repo update
- helm pull gitlab_qa/
#{
package_name
}
only:
- "
#{
client_project
.
default_branch
}
"
tags:
- "runner-for-
#{
client_project
.
group
.
name
}
"
YAML
}
end
%i[personal_access_token ci_job_token project_deploy_token]
.
each
do
|
authentication_token_type
|
context
"using a
#{
authentication_token_type
}
"
do
let
(
:username
)
do
case
authentication_token_type
when
:personal_access_token
Runtime
::
User
.
username
when
:ci_job_token
'gitlab-ci-token'
when
:project_deploy_token
project_deploy_token
.
username
end
end
let
(
:access_token
)
do
case
authentication_token_type
when
:personal_access_token
personal_access_token
when
:ci_job_token
'${CI_JOB_TOKEN}'
when
:project_deploy_token
project_deploy_token
.
password
end
end
it
"pushes and pulls a helm chart"
do
# pushing
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
package_project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
([
package_gitlab_ci_file
,
package_chart_yaml_file
])
end
package_project
.
visit!
Flow
::
Pipeline
.
visit_latest_pipeline
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
pipeline
.
click_job
(
'deploy'
)
end
Page
::
Project
::
Job
::
Show
.
perform
do
|
job
|
expect
(
job
).
to
be_successful
(
timeout:
800
)
end
Page
::
Project
::
Menu
.
perform
(
&
:click_packages_link
)
Page
::
Project
::
Packages
::
Index
.
perform
do
|
index
|
expect
(
index
).
to
have_package
(
package_name
)
index
.
click_package
(
package_name
)
end
Page
::
Project
::
Packages
::
Show
.
perform
do
|
show
|
expect
(
show
).
to
have_package_info
(
package_name
,
package_version
)
end
# pulling
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
client_project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
([
client_gitlab_ci_file
])
end
client_project
.
visit!
Flow
::
Pipeline
.
visit_latest_pipeline
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
pipeline
.
click_job
(
'pull'
)
end
Page
::
Project
::
Job
::
Show
.
perform
do
|
job
|
expect
(
job
).
to
be_successful
(
timeout:
800
)
end
end
end
end
end
end
end
qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb
View file @
5fb6d9f7
...
...
@@ -9,57 +9,13 @@ module QA
describe
'Maven Repository with Gradle'
do
using
RSpec
::
Parameterized
::
TableSyntax
include
Runtime
::
Fixtures
include_context
'packages registry qa scenario'
let
(
:group_id
)
{
'com.gitlab.qa'
}
let
(
:artifact_id
)
{
'maven_gradle'
}
let
(
:package_name
)
{
"
#{
group_id
}
/
#{
artifact_id
}
"
.
tr
(
'.'
,
'/'
)
}
let
(
:package_version
)
{
'1.3.7'
}
let
(
:personal_access_token
)
{
Runtime
::
Env
.
personal_access_token
}
let
(
:package_project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'maven-with-gradle-project'
project
.
initialize_with_readme
=
true
project
.
visibility
=
:private
end
end
let
(
:client_project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
client_project
|
client_project
.
name
=
'gradle_client'
client_project
.
initialize_with_readme
=
true
client_project
.
group
=
package_project
.
group
end
end
let
(
:package
)
do
Resource
::
Package
.
init
do
|
package
|
package
.
name
=
package_name
package
.
project
=
package_project
end
end
let
(
:runner
)
do
Resource
::
Runner
.
fabricate!
do
|
runner
|
runner
.
name
=
"qa-runner-
#{
Time
.
now
.
to_i
}
"
runner
.
tags
=
[
"runner-for-
#{
package_project
.
group
.
name
}
"
]
runner
.
executor
=
:docker
runner
.
token
=
package_project
.
group
.
runners_token
end
end
let
(
:gitlab_address_with_port
)
do
uri
=
URI
.
parse
(
Runtime
::
Scenario
.
gitlab_address
)
"
#{
uri
.
scheme
}
://
#{
uri
.
host
}
:
#{
uri
.
port
}
"
end
let
(
:project_deploy_token
)
do
Resource
::
DeployToken
.
fabricate_via_browser_ui!
do
|
deploy_token
|
deploy_token
.
name
=
'maven-with-gradle-deploy-token'
deploy_token
.
project
=
package_project
end
end
let
(
:package_type
)
{
'maven_gradle'
}
let
(
:package_gitlab_ci_file
)
do
{
...
...
@@ -131,18 +87,6 @@ module QA
}
end
before
do
Flow
::
Login
.
sign_in_unless_signed_in
runner
end
after
do
runner
.
remove_via_api!
package
.
remove_via_api!
package_project
.
remove_via_api!
client_project
.
remove_via_api!
end
where
(
:authentication_token_type
,
:maven_header_name
)
do
:personal_access_token
|
'Private-Token'
:ci_job_token
|
'Job-Token'
...
...
qa/spec/spec_helper.rb
View file @
5fb6d9f7
...
...
@@ -17,6 +17,7 @@ QA::Runtime::AllureReport.configure!
QA
::
Runtime
::
Scenario
.
from_env
(
QA
::
Runtime
::
Env
.
runtime_scenario_attributes
)
Dir
[
::
File
.
join
(
__dir__
,
"support/shared_examples/*.rb"
)].
sort
.
each
{
|
f
|
require
f
}
Dir
[
::
File
.
join
(
__dir__
,
"support/shared_contexts/*.rb"
)].
sort
.
each
{
|
f
|
require
f
}
RSpec
.
configure
do
|
config
|
config
.
include
QA
::
Support
::
Matchers
::
EventuallyMatcher
...
...
qa/spec/support/shared_contexts/packages_registry_shared_context.rb
0 → 100644
View file @
5fb6d9f7
# frozen_string_literal: true
module
QA
RSpec
.
shared_context
'packages registry qa scenario'
do
let
(
:personal_access_token
)
{
Runtime
::
Env
.
personal_access_token
}
let
(
:package_project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
"
#{
package_type
}
_package_project"
project
.
initialize_with_readme
=
true
project
.
visibility
=
:private
end
end
let
(
:client_project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
client_project
|
client_project
.
name
=
"
#{
package_type
}
_client_project"
client_project
.
initialize_with_readme
=
true
client_project
.
group
=
package_project
.
group
end
end
let
(
:package
)
do
Resource
::
Package
.
init
do
|
package
|
package
.
name
=
package_name
package
.
project
=
package_project
end
end
let
(
:runner
)
do
Resource
::
Runner
.
fabricate!
do
|
runner
|
runner
.
name
=
"qa-runner-
#{
Time
.
now
.
to_i
}
"
runner
.
tags
=
[
"runner-for-
#{
package_project
.
group
.
name
}
"
]
runner
.
executor
=
:docker
runner
.
token
=
package_project
.
group
.
runners_token
end
end
let
(
:gitlab_address_with_port
)
do
uri
=
URI
.
parse
(
Runtime
::
Scenario
.
gitlab_address
)
"
#{
uri
.
scheme
}
://
#{
uri
.
host
}
:
#{
uri
.
port
}
"
end
let
(
:project_deploy_token
)
do
Resource
::
DeployToken
.
fabricate_via_browser_ui!
do
|
deploy_token
|
deploy_token
.
name
=
'helm-package-deploy-token'
deploy_token
.
project
=
package_project
end
end
before
do
Flow
::
Login
.
sign_in_unless_signed_in
runner
end
after
do
runner
.
remove_via_api!
package
.
remove_via_api!
package_project
.
remove_via_api!
client_project
.
remove_via_api!
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment