1
0
Fork 0

Further changes after service changed

master
Philip O'Toole 8 years ago
parent 829adc138e
commit d02b7e93bf

@ -8,12 +8,9 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"runtime"
) )
// Nodes represents a set of nodes currently registered at the configured Discovery URL. // DiscoResponse represents the response returned by a Discovery Service.
type Nodes []string
type DiscoResponse struct { type DiscoResponse struct {
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
DiscoID string `json:"disco_id"` DiscoID string `json:"disco_id"`
@ -42,8 +39,6 @@ func (c *Client) URL() string {
func (c *Client) Register(id, addr string) (*DiscoResponse, error) { func (c *Client) Register(id, addr string) (*DiscoResponse, error) {
m := map[string]string{ m := map[string]string{
"addr": addr, "addr": addr,
"GOOS": runtime.GOOS,
"GOARCH": runtime.GOARCH,
} }
b, err := json.Marshal(m) b, err := json.Marshal(m)
if err != nil { if err != nil {

@ -6,7 +6,6 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"runtime"
"testing" "testing"
) )
@ -92,12 +91,6 @@ func Test_ClientRegisterRequestOK(t *testing.T) {
if m["addr"] != "http://127.0.0.1" { if m["addr"] != "http://127.0.0.1" {
t.Fatalf("incorrect join address supplied by client: %s", m["addr"]) t.Fatalf("incorrect join address supplied by client: %s", m["addr"])
} }
if m["GOOS"] != runtime.GOOS {
t.Fatalf("incorrect GOOS supplied by client: %s", m["GOOS"])
}
if m["GOARCH"] != runtime.GOARCH {
t.Fatalf("incorrect GOOS supplied by client: %s", m["GOARCH"])
}
fmt.Fprintln(w, `{"created_at": "2017-02-17 04:49:05.079125", "disco_id": "68d6c7cc-f4cc-11e6-a170-2e79ea0be7b1", "nodes": ["http://127.0.0.1"]}`) fmt.Fprintln(w, `{"created_at": "2017-02-17 04:49:05.079125", "disco_id": "68d6c7cc-f4cc-11e6-a170-2e79ea0be7b1", "nodes": ["http://127.0.0.1"]}`)
})) }))

Loading…
Cancel
Save