mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Migrate to new jetstream API
Updated ees/ers implementation to use the jetstream package which separates the jetstream context from Core NATS. Removed the jsOpts fields from the NatsEE struct. We are now using the jetStreamMaxWait option directly through a timeout context. Added streamName option for NATS reader since it is now required to be specified when creating a consumer (it is not inferred based on subject anymore). Updated nats ers integration test. Removed deprecated birpc unit test. Updated tests to also use the new jetstream package. Updated tests to start the nats-server using their official driver instead of using the std go exec package. time.Sleeps are now not required anymore to wait for the server. In test configurations for nats readers, made sure that natsStreamName option is populated. It is now required for consumers to know where to subscribe. Fixed potential panic that happened when jetstreamMaxWait option would not be set.
This commit is contained in:
committed by
Dan Christian Bogos
parent
5f7bc44790
commit
bac73aa2c6
@@ -63,7 +63,6 @@ var (
|
||||
testServeHHTPFail,
|
||||
testServeHHTPFailEnableRpc,
|
||||
testServeBiJSON,
|
||||
testServeBiJSONEmptyBiRPCServer,
|
||||
testServeBiJSONInvalidPort,
|
||||
testServeBiGoB,
|
||||
testServeBiGoBInvalidPort,
|
||||
@@ -334,27 +333,6 @@ func testServeBiJSON(t *testing.T) {
|
||||
runtime.Gosched()
|
||||
}
|
||||
|
||||
func testServeBiJSONEmptyBiRPCServer(t *testing.T) {
|
||||
cfg := config.NewDefaultCGRConfig()
|
||||
caps := engine.NewCaps(100, utils.MetaBusy)
|
||||
server = NewServer(caps)
|
||||
server.RpcRegister(new(mockRegister))
|
||||
|
||||
data := engine.NewInternalDB(nil, nil, true, cfg.DataDbCfg().Items)
|
||||
dm := engine.NewDataManager(data, cfg.CacheCfg(), nil)
|
||||
|
||||
ss := sessions.NewSessionS(cfg, dm, nil)
|
||||
|
||||
expectedErr := "BiRPCServer should not be nil"
|
||||
go func() {
|
||||
if err := server.ServeBiRPC(":3430", "", ss.OnBiJSONConnect, ss.OnBiJSONDisconnect); err == nil || err.Error() != "BiRPCServer should not be nil" {
|
||||
t.Errorf("Expected %+v, received %+v", expectedErr, err)
|
||||
}
|
||||
}()
|
||||
|
||||
runtime.Gosched()
|
||||
}
|
||||
|
||||
func testServeBiJSONInvalidPort(t *testing.T) {
|
||||
cfg := config.NewDefaultCGRConfig()
|
||||
caps := engine.NewCaps(100, utils.MetaBusy)
|
||||
|
||||
Reference in New Issue
Block a user