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
c52c6c54
Commit
c52c6c54
authored
Mar 18, 2016
by
Matt Butcher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ifix(manager): test for create deployments
This is a first pass at using the new test stub to test HTTP services.
parent
e988ca1a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
deployments_test.go
cmd/manager/deployments_test.go
+21
-0
No files found.
cmd/manager/deployments_test.go
View file @
c52c6c54
package
main
import
(
"bytes"
"encoding/json"
"net/http"
"net/http/httptest"
"net/url"
...
...
@@ -28,6 +30,25 @@ func TestHealthz(t *testing.T) {
// TODO: Get the body and check on the content type and the body.
}
func
TestCreateDeployments
(
t
*
testing
.
T
)
{
c
:=
stubContext
()
tpl
:=
&
common
.
Template
{
Name
:
"foo"
}
s
:=
httpHarness
(
c
,
"POST /deployments"
,
createDeploymentHandlerFunc
)
defer
s
.
Close
()
var
b
bytes
.
Buffer
if
err
:=
json
.
NewEncoder
(
&
b
)
.
Encode
(
tpl
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
res
,
err
:=
http
.
Post
(
s
.
URL
+
"/deployments"
,
"application/json"
,
&
b
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed POST: %s"
,
err
)
}
else
if
res
.
StatusCode
!=
http
.
StatusCreated
{
t
.
Errorf
(
"Expected status %d, got %d"
,
http
.
StatusCreated
,
res
.
StatusCode
)
}
}
// httpHarness is a simple test server fixture.
// Simple fixture for standing up a test server with a single route.
//
...
...
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