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
84f5aaa7
Commit
84f5aaa7
authored
Oct 31, 2017
by
Alessio Caiazza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: mock cluster apps status API
parent
6d462cea
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
4 deletions
+51
-4
app/serializers/cluster_entity.rb
app/serializers/cluster_entity.rb
+12
-0
app/serializers/cluster_serializer.rb
app/serializers/cluster_serializer.rb
+1
-1
spec/fixtures/api/schemas/cluster_status.json
spec/fixtures/api/schemas/cluster_status.json
+33
-2
spec/serializers/cluster_entity_spec.rb
spec/serializers/cluster_entity_spec.rb
+4
-0
spec/serializers/cluster_serializer_spec.rb
spec/serializers/cluster_serializer_spec.rb
+1
-1
No files found.
app/serializers/cluster_entity.rb
View file @
84f5aaa7
...
...
@@ -3,4 +3,16 @@ class ClusterEntity < Grape::Entity
expose
:status_name
,
as: :status
expose
:status_reason
expose
:applications
do
|
cluster
,
options
|
if
cluster
.
created?
{
helm:
{
status:
'installed'
},
ingress:
{
status:
'error'
,
status_reason:
'Missing namespace'
},
runner:
{
status:
'installing'
},
prometheus:
{
status:
'installable'
}
}
else
{}
end
end
end
app/serializers/cluster_serializer.rb
View file @
84f5aaa7
...
...
@@ -2,6 +2,6 @@ class ClusterSerializer < BaseSerializer
entity
ClusterEntity
def
represent_status
(
resource
)
represent
(
resource
,
{
only:
[
:status
,
:status_reason
]
})
represent
(
resource
,
{
only:
[
:status
,
:status_reason
,
:applications
]
})
end
end
spec/fixtures/api/schemas/cluster_status.json
View file @
84f5aaa7
...
...
@@ -5,7 +5,38 @@
],
"properties"
:
{
"status"
:
{
"type"
:
"string"
},
"status_reason"
:
{
"type"
:
[
"string"
,
"null"
]
}
"status_reason"
:
{
"type"
:
[
"string"
,
"null"
]
},
"applications"
:
{
"$ref"
:
"#/definitions/applications"
}
},
"additionalProperties"
:
false
"additionalProperties"
:
false
,
"definitions"
:
{
"applications"
:
{
"type"
:
"object"
,
"additionalProperties"
:
false
,
"properties"
:
{
"helm"
:
{
"$ref"
:
"#/definitions/app_status"
},
"runner"
:
{
"$ref"
:
"#/definitions/app_status"
},
"ingress"
:
{
"$ref"
:
"#/definitions/app_status"
},
"prometheus"
:
{
"$ref"
:
"#/definitions/app_status"
}
}
},
"app_status"
:
{
"type"
:
"object"
,
"additionalProperties"
:
false
,
"properties"
:
{
"status"
:
{
"type"
:
{
"enum"
:
[
"installable"
,
"installing"
,
"installed"
,
"error"
]
}
},
"status_reason"
:
{
"type"
:
[
"string"
,
"null"
]
}
},
"required"
:
[
"status"
]
}
}
}
spec/serializers/cluster_entity_spec.rb
View file @
84f5aaa7
...
...
@@ -18,5 +18,9 @@ describe ClusterEntity do
it
'contains status reason'
do
expect
(
subject
[
:status_reason
]).
to
eq
(
'general error'
)
end
it
'contains applications'
do
expect
(
subject
[
:applications
]).
to
eq
({})
end
end
end
spec/serializers/cluster_serializer_spec.rb
View file @
84f5aaa7
...
...
@@ -12,7 +12,7 @@ describe ClusterSerializer do
let
(
:resource
)
{
create
(
:gcp_cluster
,
:errored
)
}
it
'serializes only status'
do
expect
(
subject
.
keys
).
to
contain_exactly
(
:status
,
:status_reason
)
expect
(
subject
.
keys
).
to
contain_exactly
(
:status
,
:status_reason
,
:applications
)
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