Skip to content

Commit

Permalink
Refactor server/agents ports
Browse files Browse the repository at this point in the history
Co-authored-by: iknite <[email protected]>
  • Loading branch information
Jose Luis Lucas and iknite committed Dec 18, 2018
1 parent 72931cc commit a5bb017
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion gossip/sender/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (s Sender) batcherSender(id int, ch chan *protocol.Snapshot, quit chan bool
func (s Sender) sender(batch *protocol.BatchSnapshots) {
var wg sync.WaitGroup
msg, _ := batch.Encode()
// fmt.Println("BATCH: ", batch.Snapshots)
fmt.Println("BATCH: ", batch.Snapshots)
peers := s.Agent.Topology.Each(s.Config.EachN, nil)
for _, peer := range peers.L {
fmt.Println(">>>>>> PEERS ", peers)
Expand Down
23 changes: 12 additions & 11 deletions tests/e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ var cacheSize uint64

const (
QEDUrl = "http://127.0.0.1:8080"
PubUrl = "http://127.0.0.1:8888"
StoreUrl = "http://127.0.0.1:8888"
APIKey = "my-key"
QEDGossip = "127.0.0.1:8600"
QEDGossip = "127.0.0.1:9100"
)

func init() {
Expand Down Expand Up @@ -76,7 +76,7 @@ func newAgent(id int, name string, role member.Type, p gossip.Processor, t *test

agentConf.StartJoin = []string{QEDGossip}
agentConf.EnableCompression = true
agentConf.AlertsUrls = []string{PubUrl}
agentConf.AlertsUrls = []string{StoreUrl}
agentConf.Role = role

agent, err := gossip.NewAgent(agentConf, []gossip.Processor{p})
Expand All @@ -94,7 +94,7 @@ func setupAuditor(id int, t *testing.T) (scope.TestF, scope.TestF) {
before := func(t *testing.T) {
auditorConf := auditor.DefaultConfig()
auditorConf.QEDUrls = []string{QEDUrl}
auditorConf.PubUrls = []string{PubUrl}
auditorConf.PubUrls = []string{StoreUrl}
auditorConf.APIKey = APIKey

au, err = auditor.NewAuditor(auditorConf)
Expand Down Expand Up @@ -152,14 +152,15 @@ func setupPublisher(id int, t *testing.T) (scope.TestF, scope.TestF) {

before := func(t *testing.T) {
conf := publisher.DefaultConfig()
conf.PubUrls = []string{PubUrl}
conf.PubUrls = []string{StoreUrl}

pu, err = publisher.NewPublisher(conf)
if err != nil {
t.Fatalf("Unable to create a new publisher: %v", err)
}

agent = newAgent(id, "publisher", member.Publisher, pu, t)
time.Sleep(20 * time.Second)
}

after := func(t *testing.T) {
Expand Down Expand Up @@ -198,10 +199,10 @@ func setupServer(id int, joinAddr string, t *testing.T) (scope.TestF, scope.Test
hostname, _ := os.Hostname()
conf := server.DefaultConfig()
conf.NodeID = fmt.Sprintf("%s-%d", hostname, id)
conf.HttpAddr = fmt.Sprintf("127.0.0.1:850%d", id)
conf.RaftAddr = fmt.Sprintf("127.0.0.1:830%d", id)
conf.MgmtAddr = fmt.Sprintf("127.0.0.1:840%d", id)
conf.GossipAddr = fmt.Sprintf("127.0.0.1:860%d", id)
conf.HttpAddr = fmt.Sprintf("127.0.0.1:808%d", id)
conf.RaftAddr = fmt.Sprintf("127.0.0.1:900%d", id)
conf.MgmtAddr = fmt.Sprintf("127.0.0.1:809%d", id)
conf.GossipAddr = fmt.Sprintf("127.0.0.1:910%d", id)
conf.DBPath = path + "data"
conf.RaftPath = path + "raft"
conf.PrivateKeyPath = keyFile
Expand All @@ -221,7 +222,7 @@ func setupServer(id int, joinAddr string, t *testing.T) (scope.TestF, scope.Test
t.Log(err)
}
})()
time.Sleep(5 * time.Second)
time.Sleep(2 * time.Second)
}

after := func(t *testing.T) {
Expand All @@ -235,7 +236,7 @@ func setupServer(id int, joinAddr string, t *testing.T) (scope.TestF, scope.Test
}

func endPoint(id int) string {
return fmt.Sprintf("http://127.0.0.1:850%d", id)
return fmt.Sprintf("http://127.0.0.1:808%d", id)
}

func getClient(id int) *client.HttpClient {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tamper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
)

func getSnapshot(version uint64) (*protocol.SignedSnapshot, error) {
resp, err := http.Get(fmt.Sprintf("%s/snapshot?v=%d", PubUrl, version))
resp, err := http.Get(fmt.Sprintf("%s/snapshot?v=%d", StoreUrl, version))
if err != nil {
return nil, fmt.Errorf("Error getting snapshot from the store: %v", err)
}
Expand Down

0 comments on commit a5bb017

Please sign in to comment.