Skip to content

Commit

Permalink
Added MongoStore to Test Server
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleklaussconn committed Nov 8, 2023
1 parent 01702d7 commit fcd43ec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ jobs:
matrix:
go: [1.21]
store-type:
-
- memory
- file
- mongo
fix-version:
-
- fix40
Expand All @@ -65,10 +67,15 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Test
- name: Unit test
env:
FIX_TEST: ${{ matrix.fix-version }}
STORE_TYPE: ${{ matrix.store-type }}
run: if [ -z $FIX_TEST ] && [ -z $STORE_TYPE ]; then make build-src && make test-ci; fi
- name: Acceptance test
env:
GO111MODULE: on
MONGODB_TEST_CXN: mongodb://localhost:27017
FIX_TEST: ${{ matrix.fix-version }}
STORE_TYPE: ${{ matrix.store-type }}
run: if [ -z $FIX_TEST ]; then make build-src && make test-ci; else make generate-ci && make build && make $FIX_TEST; fi
run: if [ $FIX_TEST ] && [ $STORE_TYPE ]; then make generate-ci && make build && make $FIX_TEST; fi
13 changes: 13 additions & 0 deletions _test/test-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,23 @@ func main() {

var acceptor *quickfix.Acceptor
switch strings.ToUpper(storeType) {
case "MONGO":
mongoDbCxn := "mongodb://localhost:27017"
mongoDatabase := "automated_testing_database"
mongoReplicaSet := "replicaset"

appSettings.GlobalSettings().Set(config.MongoStoreConnection, mongoDbCxn)
appSettings.GlobalSettings().Set(config.MongoStoreDatabase, mongoDatabase)
appSettings.GlobalSettings().Set(config.MongoStoreReplicaSet, mongoReplicaSet)
appSettings.GlobalSettings().Set(config.DynamicSessions, "Y")

acceptor, err = quickfix.NewAcceptor(app, quickfix.NewMongoStoreFactory(appSettings), appSettings, fileLogFactory)
case "FILE":
fileStoreRootPath := path.Join(os.TempDir(), fmt.Sprintf("FileStoreTestSuite-%d", os.Getpid()))
fileStorePath := path.Join(fileStoreRootPath, fmt.Sprintf("%d", time.Now().UnixNano()))
appSettings.GlobalSettings().Set(config.FileStorePath, fileStorePath)
appSettings.GlobalSettings().Set(config.DynamicSessions, "Y")

acceptor, err = quickfix.NewAcceptor(app, quickfix.NewFileStoreFactory(appSettings), appSettings, fileLogFactory)
case "MEMORY":
acceptor, err = quickfix.NewAcceptor(app, quickfix.NewMemoryStoreFactory(), appSettings, fileLogFactory)
Expand Down
1 change: 0 additions & 1 deletion filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func (f fileStoreFactory) Create(sessionID SessionID) (msgStore MessageStore, er

dirname, err := sessionSettings.Setting(config.FileStorePath)
if err != nil {
dirname, err = globalSettings.Setting(config.FileStorePath)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit fcd43ec

Please sign in to comment.