Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
61dd6644
Commit
61dd6644
authored
Mar 21, 2016
by
Michelle Noorali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ref(manager): add /healthz body/content-type test
parent
8c55a6ef
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
deployments_test.go
cmd/manager/deployments_test.go
+19
-1
No files found.
cmd/manager/deployments_test.go
View file @
61dd6644
...
@@ -3,7 +3,9 @@ package main
...
@@ -3,7 +3,9 @@ package main
import
(
import
(
"bytes"
"bytes"
"encoding/json"
"encoding/json"
"io/ioutil"
"net/http"
"net/http"
"strings"
"testing"
"testing"
"github.com/kubernetes/helm/pkg/common"
"github.com/kubernetes/helm/pkg/common"
...
@@ -15,13 +17,29 @@ func TestHealthz(t *testing.T) {
...
@@ -15,13 +17,29 @@ func TestHealthz(t *testing.T) {
defer
s
.
Close
()
defer
s
.
Close
()
res
,
err
:=
http
.
Get
(
s
.
URL
)
res
,
err
:=
http
.
Get
(
s
.
URL
)
if
err
!=
nil
{
t
.
Fatalf
(
"err on http get: %v"
,
err
)
}
body
,
err
:=
ioutil
.
ReadAll
(
res
.
Body
)
defer
res
.
Body
.
Close
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to GET healthz: %s"
,
err
)
t
.
Fatalf
(
"Failed to GET healthz: %s"
,
err
)
}
else
if
res
.
StatusCode
!=
200
{
}
else
if
res
.
StatusCode
!=
200
{
t
.
Fatalf
(
"Unexpected status: %d"
,
res
.
StatusCode
)
t
.
Fatalf
(
"Unexpected status: %d"
,
res
.
StatusCode
)
}
}
// TODO: Get the body and check on the content type and the body.
expectedBody
:=
"OK"
if
bytes
.
Equal
(
body
,
[]
byte
(
expectedBody
))
{
t
.
Fatalf
(
"Expected response body: %s, Actual response body: %s"
,
expectedBody
,
string
(
body
))
}
expectedContentType
:=
"text/plain"
contentType
:=
res
.
Header
[
"Content-Type"
][
0
]
if
!
strings
.
Contains
(
contentType
,
expectedContentType
)
{
t
.
Fatalf
(
"Expected Content-Type to include %s"
,
expectedContentType
)
}
}
}
func
TestCreateDeployments
(
t
*
testing
.
T
)
{
func
TestCreateDeployments
(
t
*
testing
.
T
)
{
...
...
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