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
7b3f3de2
Commit
7b3f3de2
authored
Nov 10, 2020
by
Ramya Authappan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'composer-registry-test' into 'master'
Add Composer test See merge request gitlab-org/gitlab!46330
parents
2f547542
62952b2a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
121 additions
and
0 deletions
+121
-0
qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb
...s/features/browser_ui/5_package/composer_registry_spec.rb
+121
-0
No files found.
qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb
0 → 100644
View file @
7b3f3de2
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Package'
,
:orchestrated
,
:packages
do
describe
'Composer Repository'
do
include
Runtime
::
Fixtures
let
(
:package_name
)
{
'my_package'
}
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'composer-package-project'
end
end
let!
(
:runner
)
do
Resource
::
Runner
.
fabricate!
do
|
runner
|
runner
.
name
=
"qa-runner-
#{
Time
.
now
.
to_i
}
"
runner
.
tags
=
[
"runner-for-
#{
project
.
name
}
"
]
runner
.
executor
=
:docker
runner
.
project
=
project
end
end
let!
(
:gitlab_address_with_port
)
do
uri
=
URI
.
parse
(
Runtime
::
Scenario
.
gitlab_address
)
"
#{
uri
.
scheme
}
://
#{
uri
.
host
}
:
#{
uri
.
port
}
"
end
let
(
:composer_json_file
)
do
<<~
EOF
{
"name": "
#{
project
.
path_with_namespace
}
/
#{
package_name
}
",
"description": "Library XY",
"type": "library",
"license": "GPL-3.0-only",
"authors": [
{
"name": "John Doe",
"email": "john@example.com"
}
],
"require": {}
}
EOF
end
let
(
:gitlab_ci_yaml
)
do
<<~
YAML
publish:
image: curlimages/curl:latest
stage: build
variables:
URL: "$CI_SERVER_PROTOCOL://$CI_SERVER_HOST:$CI_SERVER_PORT/api/v4/projects/$CI_PROJECT_ID/packages/composer?job_token=$CI_JOB_TOKEN"
script:
- version=$([[ -z "$CI_COMMIT_TAG" ]] && echo "branch=$CI_COMMIT_REF_NAME" || echo "tag=$CI_COMMIT_TAG")
- insecure=$([ "$CI_SERVER_PROTOCOL" = "http" ] && echo "--insecure" || echo "")
- response=$(curl -s -w "%{http_code}" $insecure --data $version $URL)
- code=$(echo "$response" | tail -n 1)
- body=$(echo "$response" | head -n 1)
tags:
- "runner-for-
#{
project
.
name
}
"
YAML
end
before
do
Flow
::
Login
.
sign_in
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
project
commit
.
commit_message
=
'Add .gitlab-ci.yml'
commit
.
add_files
([{
file_path:
'.gitlab-ci.yml'
,
content:
gitlab_ci_yaml
},
{
file_path:
'composer.json'
,
content:
composer_json_file
}]
)
end
project
.
visit!
Page
::
Project
::
Menu
.
perform
(
&
:click_ci_cd_pipelines
)
Page
::
Project
::
Pipeline
::
Index
.
perform
(
&
:click_on_latest_pipeline
)
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
pipeline
|
pipeline
.
click_job
(
'publish'
)
end
Page
::
Project
::
Job
::
Show
.
perform
do
|
job
|
expect
(
job
).
to
be_successful
(
timeout:
800
)
end
end
after
do
runner
.
remove_via_api!
end
it
'publishes a composer package and deletes it'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1088'
do
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
|
package
|
package
.
click_delete
end
Page
::
Project
::
Packages
::
Index
.
perform
do
|
index
|
aggregate_failures
'package deletion'
do
expect
(
index
).
to
have_content
(
"Package deleted successfully"
)
expect
(
index
).
to
have_no_package
(
package_name
)
end
end
end
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