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
0dba4721
Commit
0dba4721
authored
Oct 28, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for migration
parent
c938349f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
spec/migrations/20201027002551_migrate_services_to_http_integrations_spec.rb
...01027002551_migrate_services_to_http_integrations_spec.rb
+27
-0
No files found.
spec/migrations/20201027002551_migrate_services_to_http_integrations_spec.rb
0 → 100644
View file @
0dba4721
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'migrate'
,
'20201027002551_migrate_services_to_http_integrations.rb'
)
RSpec
.
describe
MigrateServicesToHttpIntegrations
do
let_it_be
(
:namespace
)
{
table
(
:namespaces
).
create!
(
name:
'namespace'
,
path:
'namespace'
)
}
let_it_be
(
:project
)
{
table
(
:projects
).
create!
(
id:
1
,
namespace_id:
namespace
.
id
)
}
let_it_be
(
:alert_service
)
{
table
(
:services
).
create
(
type:
'AlertsService'
,
project_id:
project
.
id
)}
let_it_be
(
:alert_service_data
)
{
table
(
:alerts_service_data
).
create
(
service_id:
alert_service
.
id
,
encrypted_token:
'test'
,
encrypted_token_iv:
'test'
)}
let
(
:http_integrations
)
{
table
(
:alert_management_http_integrations
)
}
describe
'#up'
do
it
'creates the http integrations from the alert services'
,
:aggregate_failures
do
expect
{
migrate!
}.
to
change
{
http_integrations
.
count
}.
by
(
1
)
http_integration
=
http_integrations
.
last
expect
(
http_integration
.
project_id
).
to
eq
(
alert_service
.
project_id
)
expect
(
http_integration
.
encrypted_token
).
to
eq
(
alert_service_data
.
encrypted_token
)
expect
(
http_integration
.
encrypted_token_iv
).
to
eq
(
alert_service_data
.
encrypted_token_iv
)
expect
(
http_integration
.
active
).
to
eq
(
alert_service
.
active
)
expect
(
http_integration
.
name
).
to
eq
(
described_class
::
SERVICE_NAMES_IDENTIFIER
[
:name
])
expect
(
http_integration
.
endpoint_identifier
).
to
eq
(
described_class
::
SERVICE_NAMES_IDENTIFIER
[
:identifier
])
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