Nexus/pkg/nex/cruda/allocator_test.go

34 lines
812 B
Go
Raw Permalink Normal View History

2024-10-20 11:04:41 +00:00
package cruda_test
import (
"fmt"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
"git.solsynth.dev/hypernet/nexus/pkg/proto"
"testing"
)
func TestAllocDatabase(t *testing.T) {
conn, err := nex.NewNexusConn("127.0.0.1:7001", &proto.ServiceInfo{
Id: "alloc01",
Type: "alloc",
Label: "Allocator",
GrpcAddr: "127.0.0.1:6001",
HttpAddr: nil,
})
if err != nil {
t.Fatal(fmt.Errorf("unable to connect nexus: %v", err))
}
if err := conn.RegisterService(); err != nil {
t.Fatal(fmt.Errorf("unable to register service: %v", err))
}
2024-10-20 11:55:52 +00:00
cc := cruda.NewCrudaConn(conn)
2024-10-20 11:04:41 +00:00
dsn, err := cc.AllocDatabase("test")
if err != nil {
t.Fatal(fmt.Errorf("unable to allocate database: %v", err))
}
t.Log(fmt.Sprintf("Allocated database: %s", dsn))
}