|
|
@ -103,7 +103,7 @@ func hexAll(v string) string {
|
|
|
|
return sb.String()
|
|
|
|
return sb.String()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestHandlePeerPut(t *testing.T) {
|
|
|
|
func TestHandlePeerAPI(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
name string
|
|
|
|
isSelf bool // the peer sending the request is owned by us
|
|
|
|
isSelf bool // the peer sending the request is owned by us
|
|
|
@ -134,6 +134,21 @@ func TestHandlePeerPut(t *testing.T) {
|
|
|
|
bodyNotContains("You are the owner of this node."),
|
|
|
|
bodyNotContains("You are the owner of this node."),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name: "peer_api_goroutines_deny",
|
|
|
|
|
|
|
|
isSelf: false,
|
|
|
|
|
|
|
|
req: httptest.NewRequest("GET", "/v0/goroutines", nil),
|
|
|
|
|
|
|
|
checks: checks(httpStatus(403)),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name: "peer_api_goroutines",
|
|
|
|
|
|
|
|
isSelf: true,
|
|
|
|
|
|
|
|
req: httptest.NewRequest("GET", "/v0/goroutines", nil),
|
|
|
|
|
|
|
|
checks: checks(
|
|
|
|
|
|
|
|
httpStatus(200),
|
|
|
|
|
|
|
|
bodyContains("ServeHTTP"),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "reject_non_owner_put",
|
|
|
|
name: "reject_non_owner_put",
|
|
|
|
isSelf: false,
|
|
|
|
isSelf: false,
|
|
|
|