Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Mongo to Test Server #596

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading