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
6c189545
Commit
6c189545
authored
Nov 25, 2021
by
Alan (Maciej) Paruszewski
Committed by
Luke Duncalfe
Nov 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for cluster image scanning security policies
parent
261bc584
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
10 deletions
+28
-10
ee/spec/services/security/security_orchestration_policies/cluster_image_scanning_ci_variables_service_spec.rb
...icies/cluster_image_scanning_ci_variables_service_spec.rb
+28
-10
No files found.
ee/spec/services/security/security_orchestration_policies/cluster_image_scanning_ci_variables_service_spec.rb
View file @
6c189545
...
...
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec
.
describe
Security
::
SecurityOrchestrationPolicies
::
ClusterImageScanningCiVariablesService
do
describe
'#execute'
do
let_it_be_with_re
loa
d
(
:project
)
{
create
(
:project
)
}
let_it_be_with_re
fin
d
(
:project
)
{
create
(
:project
)
}
let
(
:service
)
{
described_class
.
new
(
project:
project
)
}
let_it_be
(
:ci_variables
)
do
...
...
@@ -55,15 +55,7 @@ RSpec.describe Security::SecurityOrchestrationPolicies::ClusterImageScanningCiVa
end
end
context
'when cluster was not found'
do
it_behaves_like
'with cluster image scanning resource filters'
it_behaves_like
'without variable attributes'
end
context
'when cluster was found'
do
let_it_be
(
:cluster
)
{
create
(
:cluster
,
:with_environments
,
:provided_by_user
,
name:
'production'
)
}
let_it_be
(
:project
)
{
cluster
.
kubernetes_namespaces
.
first
.
project
}
shared_examples
'for created cluster'
do
context
'when cluster with requested name does not exist'
do
let
(
:requested_cluster
)
{
'gilab-managed-apps'
}
...
...
@@ -81,5 +73,31 @@ RSpec.describe Security::SecurityOrchestrationPolicies::ClusterImageScanningCiVa
end
end
end
context
'when cluster was not found'
do
it_behaves_like
'with cluster image scanning resource filters'
it_behaves_like
'without variable attributes'
end
context
'when cluster was found for the group'
do
let_it_be_with_refind
(
:cluster
)
{
create
(
:cluster
,
:group
,
:provided_by_user
,
name:
'production'
)
}
let_it_be_with_refind
(
:project
)
{
create
(
:project
,
group:
cluster
.
groups
.
first
)
}
include_examples
'for created cluster'
end
context
'when cluster was found for the instance'
do
let_it_be_with_refind
(
:cluster
)
{
create
(
:cluster
,
:instance
,
:provided_by_user
,
name:
'production'
)
}
let_it_be_with_refind
(
:project
)
{
create
(
:project
)
}
include_examples
'for created cluster'
end
context
'when cluster was found for the project'
do
let_it_be_with_refind
(
:cluster
)
{
create
(
:cluster
,
:project
,
:provided_by_user
,
name:
'production'
)
}
let_it_be_with_refind
(
:project
)
{
cluster
.
projects
.
first
}
include_examples
'for created cluster'
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