Skip to content

Commit

Permalink
Initial requisition of IP address; Publish ip-address.assigned events (
Browse files Browse the repository at this point in the history
…#9)

* Add initial requesting of IP address for load balancer; publish initial event

Signed-off-by: Tyler Auerbeck <[email protected]>

* Fix lints

Signed-off-by: Tyler Auerbeck <[email protected]>

* Stub in IPAM mock for now

Signed-off-by: Tyler Auerbeck <[email protected]>

---------

Signed-off-by: Tyler Auerbeck <[email protected]>
Co-authored-by: Tyler Auerbeck <[email protected]>
  • Loading branch information
tylerauerbeck and tylerauerbeck authored Jun 30, 2023
1 parent 6b983c8 commit fe2cf02
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 50 deletions.
37 changes: 31 additions & 6 deletions cmd/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"

"go.infratographer.com/ipam-api/pkg/ipamclient"
"go.infratographer.com/loadbalancer-manager-haproxy/pkg/lbapi"
"go.infratographer.com/loadbalancer-manager-haproxy/x/oauth2x"
"go.infratographer.com/x/echox"
Expand Down Expand Up @@ -39,13 +40,13 @@ func init() {
// only available as a CLI arg because it shouldn't be something that could accidentially end up in a config file or env var
processCmd.Flags().BoolVar(&processDevMode, "dev", false, "dev mode: disables all auth checks, pretty logging, etc.")

processCmd.PersistentFlags().String("api-endpoint", "http://localhost:7608", "endpoint for load balancer API")
processCmd.PersistentFlags().String("api-endpoint", "http://localhost:7608", "endpoint for load balancer API. defaults to supergraph-endpoint if set")
viperx.MustBindFlag(viper.GetViper(), "api-endpoint", processCmd.PersistentFlags().Lookup("api-endpoint"))

processCmd.PersistentFlags().String("ipam-endpoint", "http://localhost:7609", "endpoint for IPAM API")
processCmd.PersistentFlags().String("ipam-endpoint", "http://localhost:7608", "endpoint for IPAM API. defaults to supergraph-endpoint if set")
viperx.MustBindFlag(viper.GetViper(), "ipam-endpoint", processCmd.PersistentFlags().Lookup("ipam-endpoint"))

processCmd.PersistentFlags().String("supergraph-endpoint", "http://localhost:8067", "endpoint for infratographer supergraph")
processCmd.PersistentFlags().String("supergraph-endpoint", "", "endpoint for load balancer API")
viperx.MustBindFlag(viper.GetViper(), "supergraph-endpoint", processCmd.PersistentFlags().Lookup("supergraph-endpoint"))

processCmd.PersistentFlags().StringSlice("event-locations", nil, "location id(s) to filter events for")
Expand All @@ -54,6 +55,10 @@ func init() {
processCmd.PersistentFlags().StringSlice("event-topics", nil, "event topics to subscribe to")
viperx.MustBindFlag(viper.GetViper(), "event-topics", processCmd.PersistentFlags().Lookup("event-topics"))

processCmd.PersistentFlags().String("ipblock", "", "ip block id to use for requesting load balancer IPs")
viperx.MustBindFlag(viper.GetViper(), "ipblock", processCmd.PersistentFlags().Lookup("ipblock"))

events.MustViperFlagsForPublisher(viper.GetViper(), processCmd.Flags(), appName)
events.MustViperFlagsForSubscriber(viper.GetViper(), processCmd.Flags())
oauth2x.MustViperFlags(viper.GetViper(), processCmd.Flags())

Expand All @@ -80,18 +85,30 @@ func process(ctx context.Context, logger *zap.SugaredLogger) error {
Logger: logger,
SubscriberConfig: config.AppConfig.Events.Subscriber,
Topics: viper.GetStringSlice("event-topics"),
IPBlock: viper.GetString("ipblock"),
}

// init lbapi client
// init lbapi client and ipam client
if config.AppConfig.OIDC.ClientID != "" {
oauthHTTPClient := oauth2x.NewClient(ctx, oauth2x.NewClientCredentialsTokenSrc(ctx, config.AppConfig.OIDC))
server.APIClient = lbapi.NewClient(viper.GetString("api-endpoint"),
server.APIClient = lbapi.NewClient(determineEndpoint(viper.GetString("api-endpoint"), viper.GetString("supergraph-endpoint")),
lbapi.WithHTTPClient(oauthHTTPClient),
)
server.IPAMClient = ipamclient.NewClient(determineEndpoint(viper.GetString("api-endpoint"), viper.GetString("supergraph-endpoint")),
ipamclient.WithHTTPClient(oauthHTTPClient),
)
} else {
server.APIClient = lbapi.NewClient(viper.GetString("api-endpoint"))
server.APIClient = lbapi.NewClient(determineEndpoint(viper.GetString("api-endpoint"), viper.GetString("supergraph-endpoint")))
server.IPAMClient = ipamclient.NewClient(determineEndpoint(viper.GetString("ipam-endpoint"), viper.GetString("supergraph-endpoint")))
}

pub, err := events.NewPublisher(config.AppConfig.Events.Publisher)
if err != nil {
logger.Fatalw("failed to create publisher", "error", err)
}

server.Publisher = pub

if err := server.Run(cx); err != nil {
logger.Fatalw("failed starting server", "error", err)
cancel()
Expand All @@ -107,3 +124,11 @@ func process(ctx context.Context, logger *zap.SugaredLogger) error {

return nil
}

func determineEndpoint(endpoint string, supergraph string) string {
if supergraph != "" {
return supergraph
}

return endpoint
}
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ var rootCmd = &cobra.Command{
Long: "A controller for processing requests related to loadbalancer provisioning",
}

var appName = "loadbalancerproviderhaproxy"

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ require (
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
go.infratographer.com/loadbalancer-manager-haproxy v0.0.0-20230612145135-7bf6c8074a9e
go.infratographer.com/x v0.3.1-0.20230605180922-67c1a1e705ac
go.infratographer.com/ipam-api v0.0.3-0.20230627135853-8acda8f15bbe
go.infratographer.com/loadbalancer-manager-haproxy v0.0.2-0.20230629042532-5524391bd0b6
go.infratographer.com/x v0.3.2
go.uber.org/zap v1.24.0
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
)

require (
github.com/3th1nk/cidr v0.2.0 // indirect
github.com/MicahParks/keyfunc/v2 v2.0.3 // indirect
github.com/ThreeDotsLabs/watermill-nats/v2 v2.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand All @@ -29,7 +31,7 @@ require (
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jaevor/go-nanoid v1.3.0 // indirect
Expand Down
17 changes: 11 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/3th1nk/cidr v0.2.0 h1:81jjEknszD8SHPLVTPPk+BZjNVqq1ND2YXLSChl6Lrs=
github.com/3th1nk/cidr v0.2.0/go.mod h1:XsSQnS4rEYyB2veDfnIGgViulFpIITPKtp3f0VxpiLw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/MicahParks/keyfunc/v2 v2.0.3 h1:uKUEOc+knRO0UoucONisgNPiT85V2s/W5c0FQYsd9kc=
Expand Down Expand Up @@ -168,8 +170,8 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0 h1:t7uX3JBHdVwAi3G7sSSdbsk8NfgA+LnUS88V/2EKaA0=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0/go.mod h1:4OGVnY4qf2+gw+ssiHbW+pq4mo2yko94YxxMmXZ7jCA=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 h1:1JYBfzqrWPcCclBwxFCPAou9n+q86mfnu7NAeHfte7A=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0/go.mod h1:YDZoGHuwE+ov0c8smSH49WLF3F2LaWnYYuDVd+EWrc0=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
Expand Down Expand Up @@ -284,6 +286,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
Expand All @@ -299,10 +302,12 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.infratographer.com/loadbalancer-manager-haproxy v0.0.0-20230612145135-7bf6c8074a9e h1:1tpVzkkoP+HKC6AjLKWvm6Z25rYqeIN/Lh2dorQNWx0=
go.infratographer.com/loadbalancer-manager-haproxy v0.0.0-20230612145135-7bf6c8074a9e/go.mod h1:mrwcbc0ljw0up+sX+umoa1FydiqSeMiynlR6QIO9dqU=
go.infratographer.com/x v0.3.1-0.20230605180922-67c1a1e705ac h1:5PFHsIXYJqF6ALLA39JicYzkSeLOgeF1zg3Vr68GZm8=
go.infratographer.com/x v0.3.1-0.20230605180922-67c1a1e705ac/go.mod h1:GvOhGwi/1Dp5qAQSudHUdLfFmiXzzc27KBfkH0nxnEQ=
go.infratographer.com/ipam-api v0.0.3-0.20230627135853-8acda8f15bbe h1:FEVVwb8uQyhHnS/JPLiESecdtbePQ44hss7GiG0xI4o=
go.infratographer.com/ipam-api v0.0.3-0.20230627135853-8acda8f15bbe/go.mod h1:AYzfwMo3pcgtc/9FbkJIJ0XYsGFCYoKOmeriwEp3pzk=
go.infratographer.com/loadbalancer-manager-haproxy v0.0.2-0.20230629042532-5524391bd0b6 h1:xUXYHpIUBapFCRfr4TTk7DuycJwPA25Y2emaoEycum0=
go.infratographer.com/loadbalancer-manager-haproxy v0.0.2-0.20230629042532-5524391bd0b6/go.mod h1:mrwcbc0ljw0up+sX+umoa1FydiqSeMiynlR6QIO9dqU=
go.infratographer.com/x v0.3.2 h1:AxHY77AGhWcRNcO7ENP/4Cj0xg6KGKpxFn/yZn+rPOs=
go.infratographer.com/x v0.3.2/go.mod h1:GvOhGwi/1Dp5qAQSudHUdLfFmiXzzc27KBfkH0nxnEQ=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
Expand Down
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ var AppConfig struct {
// EventsConfig stores the configuration for a load-balancer-api events config
type EventsConfig struct {
Subscriber events.SubscriberConfig
Publisher events.PublisherConfig
}
20 changes: 14 additions & 6 deletions internal/ipam/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,28 @@ import (
"context"

"go.uber.org/zap"

"go.infratographer.com/ipam-api/pkg/ipamclient"
)

// TODO: need to add ipam client

// RequestAddress will request an address for the specified loadbalancer
func RequestAddress(ctx context.Context, logger *zap.SugaredLogger, lbID string) error {
// TODO: actually request address
logger.Infow("requesting address", "loadbalancer_id", lbID)
return nil
func RequestAddress(ctx context.Context, c *ipamclient.Client, logger *zap.SugaredLogger, blockID string, lbID string, lbOwner string) (string, error) {
logger.Debugw("requesting address", "loadbalancer_id", lbID)

ip, err := c.CreateIPAddressFromBlock(ctx, blockID, lbID, lbOwner, false)
if err != nil {
logger.Debugw("unable to request ip address from IP block", "error", err, "block id", blockID, "load balancer", lbID)
return "", err
}

return ip.IPAddress.IPAddress.IP, nil
}

// ReleaseAddress will release an address from the specified loadbalancer
func ReleaseAddress(ctx context.Context, logger *zap.SugaredLogger, lbID string) error {
func ReleaseAddress(ctx context.Context, c *ipamclient.Client, logger *zap.SugaredLogger, lbID string) error {
// TODO: actually release address
logger.Infow("releasing address", "loadbalancer_id", lbID)
logger.Debugw("releasing address", "loadbalancer_id", lbID)
return nil
}
23 changes: 9 additions & 14 deletions internal/ipam/handlers_test.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
package ipam_test

import (
"context"
"testing"

"github.com/stretchr/testify/assert"
"go.infratographer.com/x/gidx"
"go.uber.org/zap"

"go.infratographer.com/loadbalancer-provider-haproxy/internal/ipam"
)
import "testing"

// TODO: fix test with ipam mock client
func TestRequestAddress(t *testing.T) {
err := ipam.RequestAddress(context.TODO(), zap.NewNop().Sugar(), gidx.MustNewID("loadbal").String())
assert.NoError(t, err)
// err := ipam.RequestAddress(context.TODO(), zap.NewNop().Sugar(), gidx.MustNewID("loadbal").String())
// assert.NoError(t, err)
// return
}

// TODO: fix test with ipam mock client
func TestReleaseAddress(t *testing.T) {
err := ipam.ReleaseAddress(context.TODO(), zap.NewNop().Sugar(), gidx.MustNewID("loadbal").String())
assert.NoError(t, err)
// err := ipam.ReleaseAddress(context.TODO(), zap.NewNop().Sugar(), gidx.MustNewID("loadbal").String())
// assert.NoError(t, err)
// return
}
7 changes: 4 additions & 3 deletions internal/ipam/tools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import (
"os"
"testing"

"go.infratographer.com/x/events"
"go.infratographer.com/x/testing/eventtools"
)

var SC events.SubscriberConfig
var (
nats *eventtools.TestNats
)

func TestMain(m *testing.M) {
setup()
Expand All @@ -24,7 +25,7 @@ func TestMain(m *testing.M) {

func setup() {
var err error
_, SC, err = eventtools.NewNatsServer()
nats, err = eventtools.NewNatsServer()

if err != nil {
errPanic("failed to start nats server", err)
Expand Down
19 changes: 17 additions & 2 deletions internal/server/changes.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
package server

import (
"time"

"go.infratographer.com/loadbalancer-provider-haproxy/internal/ipam"
"go.infratographer.com/loadbalancer-provider-haproxy/internal/loadbalancer"

"go.infratographer.com/x/events"
)

func (s *Server) processLoadBalancerChangeCreate(lb *loadbalancer.LoadBalancer) error {
if err := ipam.RequestAddress(s.Context, s.Logger, lb.LoadBalancerID.String()); err != nil {
if ip, err := ipam.RequestAddress(s.Context, s.IPAMClient, s.Logger, s.IPBlock, lb.LoadBalancerID.String(), lb.LbData.LoadBalancer.Owner.ID); err != nil {
return err
} else {
msg := events.EventMessage{
EventType: "ip-address.assigned",
SubjectID: lb.LoadBalancerID,
Timestamp: time.Now().UTC(),
}

if err := s.Publisher.PublishEvent(s.Context, "load-balancer", msg); err != nil {
s.Logger.Debugw("failed to publish event", "error", err, "ip", ip, "loadbalancer", lb.LoadBalancerID, "block", s.IPBlock)
return err
}
}

return nil
}

func (s *Server) processLoadBalancerChangeDelete(lb *loadbalancer.LoadBalancer) error {
if err := ipam.ReleaseAddress(s.Context, s.Logger, lb.LoadBalancerID.String()); err != nil {
if err := ipam.ReleaseAddress(s.Context, s.IPAMClient, s.Logger, lb.LoadBalancerID.String()); err != nil {
return err
}

Expand Down
9 changes: 7 additions & 2 deletions internal/server/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/stretchr/testify/assert"

"go.infratographer.com/ipam-api/pkg/ipamclient"
"go.infratographer.com/loadbalancer-manager-haproxy/pkg/lbapi"

"go.infratographer.com/x/echox"
Expand Down Expand Up @@ -38,6 +39,9 @@ func TestProcessChange(t *testing.T) { //nolint:govet
api := mock.DummyAPI(id.String())
api.Start()

ipamapi := mock.DummyIPAMAPI(id.String())
ipamapi.Start()

eSrv, err := echox.NewServer(zap.NewNop(), echox.Config{}, nil)
if err != nil {
errPanic("unable to initialize echo server", err)
Expand All @@ -50,19 +54,20 @@ func TestProcessChange(t *testing.T) { //nolint:govet

srv := server.Server{
APIClient: lbapi.NewClient(api.URL),
IPAMClient: ipamclient.NewClient(ipamapi.URL),
Context: context.TODO(),
Echo: eSrv,
Locations: []string{"abcd1234"},
Logger: zap.NewNop().Sugar(),
SubscriberConfig: SC,
SubscriberConfig: nats.SubscriberConfig,
Topics: []string{"*.load-balancer"},
}

// TODO: check that namespace does not exist
// TODO: check that release does not exist

// publish a message to the change channel
p, _ := events.NewPublisher(PC)
p, _ := events.NewPublisher(nats.PublisherConfig)
_ = p.PublishChange(context.TODO(), "load-balancer", events.ChangeMessage{
EventType: string(events.CreateChangeType),
SubjectID: id,
Expand Down
5 changes: 5 additions & 0 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ import (
"go.infratographer.com/x/echox"
"go.infratographer.com/x/events"
"go.uber.org/zap"

"go.infratographer.com/ipam-api/pkg/ipamclient"
)

// Server holds options for server connectivity and settings
type Server struct {
APIClient *lbapi.Client
IPAMClient *ipamclient.Client
Context context.Context
Debug bool
Echo *echox.Server
IPBlock string
Locations []string
Logger *zap.SugaredLogger
Publisher *events.Publisher
SubscriberConfig events.SubscriberConfig
Topics []string

Expand Down
2 changes: 1 addition & 1 deletion internal/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestRun(t *testing.T) {
Echo: eSrv,
Locations: []string{"abcd1234"},
Logger: zap.NewNop().Sugar(),
SubscriberConfig: SC,
SubscriberConfig: nats.SubscriberConfig,
Topics: []string{"*.load-balancer-run"},
}

Expand Down
9 changes: 2 additions & 7 deletions internal/server/tools_test.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
//go:build testtools
// +build testtools

package server_test

import (
"log"
"os"
"testing"

"go.infratographer.com/x/events"
"go.infratographer.com/x/testing/eventtools"
)

var (
SC events.SubscriberConfig
PC events.PublisherConfig
nats *eventtools.TestNats
)

func setup() {
var err error

PC, SC, err = eventtools.NewNatsServer()
nats, err = eventtools.NewNatsServer()
if err != nil {
errPanic("failed to start nats server", err)
}
Expand Down
Loading

0 comments on commit fe2cf02

Please sign in to comment.