Skip to content

Commit f5d9ccf

Browse files
author
Marvin Zhang
committed
feat: initialize configuration and enhance IPC handling in task runner tests
- Added configuration initialization in db.go to ensure proper setup of application settings. - Refactored runner_test.go to streamline IPC message handling by introducing a setupPipe function and an initRunner function for better readability and maintainability. - Improved synchronization in tests by using channels for signaling readiness and processing, enhancing the reliability of IPC message handling. - Updated test cases to validate IPC message processing and error handling, ensuring robustness in the task runner's functionality.
1 parent 8aa801e commit f5d9ccf

File tree

2 files changed

+185
-219
lines changed

2 files changed

+185
-219
lines changed

core/mongo/db.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
package mongo
22

33
import (
4+
"github.com/crawlab-team/crawlab/core/config"
45
"github.com/spf13/viper"
56
"go.mongodb.org/mongo-driver/mongo"
67
)
78

9+
func init() {
10+
config.InitConfig()
11+
}
12+
813
func GetMongoDb(dbName string) *mongo.Database {
914
// Use default database name if not provided
1015
if dbName == "" {

0 commit comments

Comments
 (0)