Skip to content

Commit

Permalink
Merge 'connect client to all cluster servers' into already implemente…
Browse files Browse the repository at this point in the history
…d TLS feature
  • Loading branch information
Jose Luis Lucas authored and iknite committed Feb 21, 2019
1 parent 78da9d6 commit d156026
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func newClientCommand(ctx *cmdContext) *cobra.Command {
}

f := cmd.PersistentFlags()
f.StringSliceVarP(&clientCtx.config.Endpoints, "endpoints", "e", []string{"127.0.0.1:8800"}, "Endpoint for REST requests on (host:port)")
f.StringSliceVarP(&clientCtx.config.Cluster, "endpoints", "e", []string{"127.0.0.1:8800"}, "Endpoint for REST requests on (host:port)")
f.BoolVar(&clientCtx.config.Insecure, "insecure", false, "Allow self signed certificates")
f.IntVar(&clientCtx.config.TimeoutSeconds, "timeout-seconds", 10, "Seconds to cut the connection")
f.IntVar(&clientCtx.config.DialTimeoutSeconds, "dial-timeout-seconds", 5, "Seconds to cut the dialing")
Expand All @@ -52,7 +52,7 @@ func newClientCommand(ctx *cmdContext) *cobra.Command {
log.SetLogger("QEDClient", ctx.logLevel)

clientCtx.config.APIKey = ctx.apiKey
clientCtx.config.Endpoints = v.GetStringSlice("client.endpoints")
clientCtx.config.Cluster = v.GetStringSlice("client.endpoints")
clientCtx.config.Insecure = v.GetBool("client.insecure")
clientCtx.config.TimeoutSeconds = v.GetInt("client.timeout.connection")
clientCtx.config.DialTimeoutSeconds = v.GetInt("client.timeout.dial")
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func NewServer(conf *Config) (*Server, error) {
}

if conf.EnableProfiling {
server.profilingServer = newHTTPServer("localhost:6060", nil)
server.profilingServer = newHTTPServer(fmt.Sprintf("localhost:606%d"), nil)
}

r := prometheus.NewRegistry()
Expand Down
12 changes: 6 additions & 6 deletions tests/e2e/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestCli(t *testing.T) {
"./../../main.go",
fmt.Sprintf("--apikey=%s", APIKey),
"client",
fmt.Sprintf("--endpoint=%s", QEDTLS),
fmt.Sprintf("--endpoints=%s", QEDTLS),
"add",
"--key='test event'",
"--value=2",
Expand All @@ -59,7 +59,7 @@ func TestCli(t *testing.T) {
"./../../main.go",
fmt.Sprintf("--apikey=%s", APIKey),
"client",
fmt.Sprintf("--endpoint=%s", QEDTLS),
fmt.Sprintf("--endpoints=%s", QEDTLS),
"membership",
"--hyperDigest=81ae2d8f6ecec9c5837d12a09e3b42a1c880b6c77f81ff1f85aef36dac4fdf6a",
"--historyDigest=0f5129eaf5dbfb1405ff072a04d716aaf4e4ba4247a3322c41582e970dbb7b00",
Expand All @@ -83,7 +83,7 @@ func TestCli(t *testing.T) {
"./../../main.go",
fmt.Sprintf("--apikey=%s", APIKey),
"client",
fmt.Sprintf("--endpoint=%s", QEDTLS),
fmt.Sprintf("--endpoints=%s", QEDTLS),
"membership",
"--hyperDigest=81ae2d8f6ecec9c5837d12a09e3b42a1c880b6c77f81ff1f85aef36dac4fdf6a",
"--historyDigest=0f5129eaf5dbfb1405ff072a04d716aaf4e4ba4247a3322c41582e970dbb7b00",
Expand All @@ -104,9 +104,9 @@ func TestCli(t *testing.T) {
}

func TestCluster(t *testing.T) {
before0, after0 := setupServer(0, "", t)
before1, after1 := setupServer(1, "", t)
before2, after2 := setupServer(2, "", t)
before0, after0 := setupServer(0, "", false, t)
before1, after1 := setupServer(1, "", false, t)
before2, after2 := setupServer(2, "", false, t)
serversHttpAddr := "http://127.0.0.1:8080,http://127.0.0.1:8081,http://127.0.0.1:8082"

scenario, let := scope.Scope(t, merge(before0, before1, before2), merge(after1, after2))
Expand Down
15 changes: 9 additions & 6 deletions tests/e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ import (
)

const (
QEDUrl = "http://127.0.0.1:8800"
QEDTLS = "https://localhost:8800"
QEDGossip = "127.0.0.1:8400"
QEDTamperURL = "http://127.0.0.1:8081/tamper"
StoreURL = "http://127.0.0.1:8888"
QEDUrl = "http://127.0.0.1:8080"
QEDTLS = "https://localhost:8080"
QEDGossip = "127.0.0.1:9010"
QEDTamperURL = "http://127.0.0.1:18080/tamper"
StoreUrl = "http://127.0.0.1:8888"
APIKey = "my-key"
cacheSize = 50000
storageType = "badger"
Expand Down Expand Up @@ -259,7 +259,10 @@ func endPoint(id int) string {

func getClient(id int) *client.HTTPClient {
return client.NewHTTPClient(client.Config{
Endpoint: endPoint(id),
Cluster: client.QEDCluster{
Endpoints: []string{endPoint(id)},
Leader: endPoint(id),
},
APIKey: APIKey,
Insecure: false,
})
Expand Down

0 comments on commit d156026

Please sign in to comment.