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

[Sweep GHA Fix] The GitHub Actions run failed on d260290 (master) with the following error logs: #784

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion pumps/logzio.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,21 @@
"raw_response": decoded.RawResponse,
"ip_address": decoded.IPAddress,
}
"ip_address": decoded.IPAddress,

Check failure on line 153 in pumps/logzio.go

View workflow job for this annotation

GitHub Actions / Go 1.21 tests

syntax error: unexpected : at end of statement
}
p.log.Info(p.GetName() + " Initialized")

event, err := json.Marshal(mapping)
if err != nil {
return fmt.Errorf("failed to marshal decoded data: %s", err)
}

p.sender.Send(event)
err = p.sender.Send(event)
if err != nil {
return fmt.Errorf("failed to send event: %s", err)
}
}
p.log.Info("Purged ", len(data), " records...")

Check failure on line 167 in pumps/logzio.go

View workflow job for this annotation

GitHub Actions / Go 1.21 tests

syntax error: non-declaration statement outside function body

return nil
}
2 changes: 1 addition & 1 deletion pumps/mgo_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (c *Conn) ConnectDb() {
if c.Store == nil {
var err error
c.Store, err = persistent.NewPersistentStorage(&persistent.ClientOpts{
Type: "mgo",
Type: "mongo-go",
ConnectionString: dbAddr,
})
if err != nil {
Expand Down
16 changes: 10 additions & 6 deletions pumps/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,6 @@ func (m *MongoPump) ensureIndexes(collectionName string) error {
}

func (m *MongoPump) connect() {
if m.dbConf.MongoDriverType == "" {
// Default to mgo
m.dbConf.MongoDriverType = persistent.Mgo
}

store, err := persistent.NewPersistentStorage(&persistent.ClientOpts{
ConnectionString: m.dbConf.MongoURL,
UseSSL: m.dbConf.MongoUseSSL,
Expand All @@ -367,7 +362,7 @@ func (m *MongoPump) connect() {
SSLPEMKeyfile: m.dbConf.MongoSSLPEMKeyfile,
SessionConsistency: m.dbConf.MongoSessionConsistency,
ConnectionTimeout: m.timeout,
Type: m.dbConf.MongoDriverType,
Type: getMongoDriverType(m.dbConf.MongoDriverType),
DirectConnection: m.dbConf.MongoDirectConnection,
})
if err != nil {
Expand Down Expand Up @@ -547,3 +542,12 @@ func (m *MongoPump) WriteUptimeData(data []interface{}) {
m.log.Error("Problem inserting to mongo collection: ", err)
}
}

func getMongoDriverType(driverType string) string {
if driverType == "" {
// Default to mongo-go
return persistent.OfficialMongo
}

return driverType
}
7 changes: 1 addition & 6 deletions pumps/mongo_aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,6 @@ func (m *MongoAggregatePump) Init(config interface{}) error {
func (m *MongoAggregatePump) connect() {
var err error

if m.dbConf.MongoDriverType == "" {
// Default to mgo
m.dbConf.MongoDriverType = persistent.Mgo
}

m.store, err = persistent.NewPersistentStorage(&persistent.ClientOpts{
ConnectionString: m.dbConf.MongoURL,
UseSSL: m.dbConf.MongoUseSSL,
Expand All @@ -229,7 +224,7 @@ func (m *MongoAggregatePump) connect() {
SSLPEMKeyfile: m.dbConf.MongoSSLPEMKeyfile,
SessionConsistency: m.dbConf.MongoSessionConsistency,
ConnectionTimeout: m.timeout,
Type: m.dbConf.MongoDriverType,
Type: getMongoDriverType(m.dbConf.MongoDriverType),
DirectConnection: m.dbConf.MongoDirectConnection,
})
if err != nil {
Expand Down
7 changes: 1 addition & 6 deletions pumps/mongo_selective.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ func (m *MongoSelectivePump) Init(config interface{}) error {
func (m *MongoSelectivePump) connect() {
var err error

if m.dbConf.MongoDriverType == "" {
// Default to mgo
m.dbConf.MongoDriverType = persistent.Mgo
}

m.store, err = persistent.NewPersistentStorage(&persistent.ClientOpts{
ConnectionString: m.dbConf.MongoURL,
UseSSL: m.dbConf.MongoUseSSL,
Expand All @@ -127,7 +122,7 @@ func (m *MongoSelectivePump) connect() {
SSLPEMKeyfile: m.dbConf.MongoSSLPEMKeyfile,
SessionConsistency: m.dbConf.MongoSessionConsistency,
ConnectionTimeout: m.timeout,
Type: m.dbConf.MongoDriverType,
Type: getMongoDriverType(m.dbConf.MongoDriverType),
DirectConnection: m.dbConf.MongoDirectConnection,
})
if err != nil {
Expand Down
32 changes: 32 additions & 0 deletions pumps/mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,3 +657,35 @@ func TestMongoPump_WriteData(t *testing.T) {
return records
}))
}
func TestGetMongoDriverType(t *testing.T) {
tests := []struct {
name string
driverType string
want string
}{
{
name: "Empty driver type",
driverType: "",
want: persistent.OfficialMongo,
},
{
name: "mongo-go driver type",
driverType: persistent.OfficialMongo,
want: persistent.OfficialMongo,
},
{
name: "mgo driver type",
driverType: persistent.Mgo,
want: persistent.Mgo,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := getMongoDriverType(tt.driverType)
if got != tt.want {
t.Errorf("got %v, want %v", got, tt.want)
}
})
}
}
Loading