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
9bb389a9
Commit
9bb389a9
authored
Nov 21, 2018
by
Amit Rathi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cert manager model spec and email presence validation
parent
96a5cf7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
0 deletions
+81
-0
app/models/clusters/applications/cert_manager.rb
app/models/clusters/applications/cert_manager.rb
+2
-0
spec/models/clusters/applications/cert_manager_spec.rb
spec/models/clusters/applications/cert_manager_spec.rb
+79
-0
No files found.
app/models/clusters/applications/cert_manager.rb
View file @
9bb389a9
...
...
@@ -14,6 +14,8 @@ module Clusters
default_value_for
:version
,
VERSION
validates
:hostname
,
presence:
true
def
chart
'stable/cert-manager'
end
...
...
spec/models/clusters/applications/cert_manager_spec.rb
0 → 100644
View file @
9bb389a9
require
'rails_helper'
describe
Clusters
::
Applications
::
CertManager
do
let
(
:cert_manager
)
{
create
(
:clusters_applications_cert_managers
)
}
include_examples
'cluster application core specs'
,
:clusters_applications_cert_managers
describe
'#make_installing!'
do
before
do
application
.
make_installing!
end
context
'application install previously errored with older version'
do
let
(
:application
)
{
create
(
:clusters_applications_cert_managers
,
:scheduled
,
version:
'v0.4.0'
)
}
it
'updates the application version'
do
expect
(
application
.
reload
.
version
).
to
eq
(
'v0.5.0'
)
end
end
end
describe
'#install_command'
do
let
(
:cluster_issuer_file
)
{
{
:"cluster_issuer.yaml"
=>
"---
\n
apiVersion: certmanager.k8s.io/v1alpha1
\n
kind: ClusterIssuer
\n
metadata:
\n
name: letsencrypt-prod
\n
spec:
\n
acme:
\n
server: https://acme-v02.api.letsencrypt.org/directory
\n
email: admin@example.com
\n
privateKeySecretRef:
\n
name: letsencrypt-prod
\n
http01: {}
\n
"
}
}
subject
{
cert_manager
.
install_command
}
it
{
is_expected
.
to
be_an_instance_of
(
Gitlab
::
Kubernetes
::
Helm
::
InstallCommand
)
}
it
'should be initialized with cert_manager arguments'
do
expect
(
subject
.
name
).
to
eq
(
'certmanager'
)
expect
(
subject
.
chart
).
to
eq
(
'stable/cert-manager'
)
expect
(
subject
.
version
).
to
eq
(
'v0.5.0'
)
expect
(
subject
).
not_to
be_rbac
expect
(
subject
.
files
).
to
eq
(
cert_manager
.
files
.
merge
(
cluster_issuer_file
))
expect
(
subject
.
postinstall
).
to
eq
([
'/usr/bin/kubectl create -f /data/helm/certmanager/config/cluster_issuer.yaml'
])
end
context
'for a specific user'
do
before
do
cert_manager
.
email
=
'abc@xyz.com'
cluster_issuer_file
[
:'cluster_issuer.yaml'
].
gsub!
'admin@example.com'
,
'abc@xyz.com'
end
it
'should use his/her email to register issuer with certificate provider'
do
expect
(
subject
.
files
).
to
eq
(
cert_manager
.
files
.
merge
(
cluster_issuer_file
))
end
end
context
'on a rbac enabled cluster'
do
before
do
cert_manager
.
cluster
.
platform_kubernetes
.
rbac!
end
it
{
is_expected
.
to
be_rbac
}
end
context
'application failed to install previously'
do
let
(
:cert_manager
)
{
create
(
:clusters_applications_cert_managers
,
:errored
,
version:
'0.0.1'
)
}
it
'should be initialized with the locked version'
do
expect
(
subject
.
version
).
to
eq
(
'v0.5.0'
)
end
end
end
describe
'#files'
do
let
(
:application
)
{
cert_manager
}
let
(
:values
)
{
subject
[
:'values.yaml'
]
}
subject
{
application
.
files
}
it
'should include cert_manager specific keys in the values.yaml file'
do
expect
(
values
).
to
include
(
'ingressShim'
)
end
end
describe
'validations'
do
it
{
is_expected
.
to
validate_presence_of
(
:email
)
}
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