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
a62fdae5
Commit
a62fdae5
authored
5 years ago
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add integration spec for legacy deployments
This documents the sitution pre-12.0
parent
e0a46916
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
ee/spec/models/project_services/kubernetes_service_spec.rb
ee/spec/models/project_services/kubernetes_service_spec.rb
+53
-0
No files found.
ee/spec/models/project_services/kubernetes_service_spec.rb
View file @
a62fdae5
...
...
@@ -12,6 +12,59 @@ describe KubernetesService, models: true, use_clean_rails_memory_store_caching:
subject
(
:rollout_status
)
{
service
.
rollout_status
(
environment
)
}
context
'legacy deployments based on app label'
do
let
(
:legacy_deployment
)
do
kube_deployment
(
name:
'legacy-deployment'
).
tap
do
|
deployment
|
deployment
[
'metadata'
][
'annotations'
].
delete
(
'app.gitlab.com/env'
)
deployment
[
'metadata'
][
'annotations'
].
delete
(
'app.gitlab.com/app'
)
deployment
[
'metadata'
][
'labels'
][
'app'
]
=
environment
.
slug
end
end
let
(
:legacy_pod
)
do
kube_pod
(
name:
'legacy-pod'
).
tap
do
|
pod
|
pod
[
'metadata'
][
'annotations'
].
delete
(
'app.gitlab.com/env'
)
pod
[
'metadata'
][
'annotations'
].
delete
(
'app.gitlab.com/app'
)
pod
[
'metadata'
][
'labels'
][
'app'
]
=
environment
.
slug
end
end
context
'only legacy deployments'
do
before
do
stub_reactive_cache
(
service
,
deployments:
[
legacy_deployment
],
pods:
[
legacy_pod
]
)
end
it
'contains legacy deployments'
do
expect
(
rollout_status
).
to
be_kind_of
(
::
Gitlab
::
Kubernetes
::
RolloutStatus
)
expect
(
rollout_status
.
deployments
.
map
(
&
:name
)).
to
contain_exactly
(
'legacy-deployment'
)
end
end
context
'new deployment based on annotations'
do
let
(
:matched_deployment
)
{
kube_deployment
(
name:
'matched-deployment'
,
environment_slug:
environment
.
slug
,
project_slug:
project
.
full_path_slug
)
}
let
(
:matched_pod
)
{
kube_pod
(
environment_slug:
environment
.
slug
,
project_slug:
project
.
full_path_slug
)
}
before
do
stub_reactive_cache
(
service
,
deployments:
[
matched_deployment
,
legacy_deployment
],
pods:
[
matched_pod
,
legacy_pod
]
)
end
it
'contains only matching deployments'
do
expect
(
rollout_status
).
to
be_kind_of
(
::
Gitlab
::
Kubernetes
::
RolloutStatus
)
expect
(
rollout_status
.
deployments
.
map
(
&
:name
)).
to
contain_exactly
(
'matched-deployment'
)
end
end
end
context
'with valid deployments'
do
let
(
:matched_deployment
)
{
kube_deployment
(
environment_slug:
environment
.
slug
,
project_slug:
project
.
full_path_slug
)
}
let
(
:unmatched_deployment
)
{
kube_deployment
}
...
...
This diff is collapsed.
Click to expand it.
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