Skip to content
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
3 changes: 3 additions & 0 deletions cli/pbm-coordinator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ func main() {
}

lis, err := net.Listen("tcp", fmt.Sprintf("%s:%d", opts.GrpcBindIP, opts.GrpcPort))
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
apilis, err := net.Listen("tcp", fmt.Sprintf("%s:%d", opts.APIBindIP, opts.APIPort))
if err != nil {
log.Fatalf("failed to listen: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion grpc/server/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func LoadMetadataFromFile(name string) (*BackupMetadata, error) {
lock: &sync.Mutex{},
}
err = json.Unmarshal(buf, &metadata.metadata)
return metadata, nil
return metadata, err
}

func (b *BackupMetadata) Metadata() *pb.BackupMetadata {
Expand Down
3 changes: 3 additions & 0 deletions grpc/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,9 @@ func (s *MessagesServer) MessagesChat(stream pb.Messages_MessagesChatServer) err
},
}
err = stream.Send(r)
if err != nil {
s.logger.Errorf("Cannot send to client stream %s: %v", clientID, err)
}

return ClientAlreadyExistsError
}
Expand Down
3 changes: 3 additions & 0 deletions internal/backup/dumper/dumper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func TestWriteToFile(t *testing.T) {
mdump.Start()
err = mdump.Wait()
tmpFile.Close()
if err != nil {
t.Errorf("Error waiting for mongodump: %v", err)
}

fi, err := os.Stat(tmpFile.Name())
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/db/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestNewDialInfo(t *testing.T) {
}

// test insecure mode
di, err := NewDialInfo(&Config{
_, err := NewDialInfo(&Config{
CertFile: TestSSLPEMKey,
CAFile: TestSSLCACert,
Insecure: true,
Expand Down
3 changes: 3 additions & 0 deletions internal/oplog/oplog_apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func TestBasicApplyLog(t *testing.T) {
}

session, err := mgo.DialWithInfo(testutils.PrimaryDialInfo(t, testutils.MongoDBShard1ReplsetName))
if err != nil {
t.Fatalf("Cannot connect to primary: %s", err)
}
ot, err := Open(session)
if err != nil {
t.Fatalf("Cannot instantiate the oplog tailer: %s", err)
Expand Down
4 changes: 4 additions & 0 deletions internal/oplog/oplog_tail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ func TestTailerCopy(t *testing.T) {

func TestSeveralOplogDocTypes(t *testing.T) {
session, err := mgo.DialWithInfo(testutils.PrimaryDialInfo(t, testutils.MongoDBShard1ReplsetName))
if err != nil {
t.Fatalf("Failed to connect to primary: %v", err)
}

// Start tailing the oplog
defer session.Close()

Expand Down
3 changes: 3 additions & 0 deletions internal/testutils/grpc/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ func NewGrpcDaemon(ctx context.Context, workDir string, t *testing.T, logger *lo

clientServerAddr := fmt.Sprintf("127.0.0.1:%s", TEST_GRPC_MESSAGES_PORT)
clientConn, err := grpc.Dial(clientServerAddr, clientOpts...)
if err != nil {
return nil, fmt.Errorf("cannot dail gRPC address %s: %v", clientServerAddr, err)
}

ports := []string{testutils.MongoDBShard1PrimaryPort, testutils.MongoDBShard1Secondary1Port, testutils.MongoDBShard1Secondary2Port,
testutils.MongoDBShard2PrimaryPort, testutils.MongoDBShard2Secondary1Port, testutils.MongoDBShard2Secondary2Port,
Expand Down
7 changes: 6 additions & 1 deletion tests/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ func TestApiWithDaemon(t *testing.T) {
t.Errorf("Metadata file %s was not found", jsonFile)
}

md, err := server.LoadMetadataFromFile(filepath.Join(tmpDir, jsonFile))
metadataFile := filepath.Join(tmpDir, jsonFile)
md, err := server.LoadMetadataFromFile(metadataFile)
if err != nil {
t.Fatalf("Cannot load metadata from file %s: %v", metadataFile, err)
}

if md.Metadata().Description == "" {
t.Errorf("Empty description in backup metadata")
}
Expand Down
4 changes: 2 additions & 2 deletions tests/general_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ func TestGlobalWithDaemon(t *testing.T) {
// and the oplog generator is starting to count from 101 sequentially, so last inserted document = count
rs1BeforeCount := rs1LastOplogDoc["o"].(bson.M)["number"].(int64)
rs2BeforeCount := rs2LastOplogDoc["o"].(bson.M)["number"].(int64)
rs1AfterCount, err := s1Session.DB(dbName).C(colName).Find(nil).Count()
rs2AfterCount, err := s2Session.DB(dbName).C(colName).Find(nil).Count()
rs1AfterCount, _ := s1Session.DB(dbName).C(colName).Find(nil).Count()
rs2AfterCount, _ := s2Session.DB(dbName).C(colName).Find(nil).Count()

if int64(rs1AfterCount) < rs1BeforeCount {
t.Errorf("Invalid documents count in rs1. Want %d, got %d", rs1BeforeCount, rs1AfterCount)
Expand Down