add prometheus
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 49s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 49s
This commit is contained in:
35
synced-pool_test.go
Normal file
35
synced-pool_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestConnection(t *testing.T) {
|
||||
// TestConnection tests the connection to the server
|
||||
t.Log("Testing connection to server")
|
||||
localPool := NewGrainLocalPool(100, time.Minute, func(id CartId) (*CartGrain, error) {
|
||||
return &CartGrain{
|
||||
Id: id,
|
||||
storageMessages: []Message{},
|
||||
Items: []CartItem{},
|
||||
TotalPrice: 0,
|
||||
}, nil
|
||||
})
|
||||
pool, err := NewSyncedPool(localPool, "localhost")
|
||||
if err != nil {
|
||||
t.Errorf("Error creating pool: %v", err)
|
||||
}
|
||||
|
||||
err = pool.AddRemote("localhost")
|
||||
if err != nil {
|
||||
t.Errorf("Error adding remote: %v", err)
|
||||
}
|
||||
allHosts, err := pool.Negotiate([]string{"kalle", "pelle"})
|
||||
if err != nil {
|
||||
t.Errorf("Error negotiating: %v", err)
|
||||
}
|
||||
if len(allHosts) != 1 {
|
||||
t.Errorf("Expected 1 host, got %d", len(allHosts))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user