Skip to content

Commit

Permalink
session: explicitly state which system fails a query
Browse files Browse the repository at this point in the history
(cherry picked from commit 4666bf1)
  • Loading branch information
Henrik Johansson committed May 16, 2019
1 parent ef7c6f4 commit cd23da2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"strings"
"time"

"github.com/pkg/errors"

"github.com/gocql/gocql"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
Expand Down Expand Up @@ -66,8 +68,12 @@ func (s *Session) Check(table Table, query string, values ...interface{}) (err e
testIter := s.testSession.Query(query, values...).Iter()
oracleIter := s.oracleSession.Query(query, values...).Iter()
defer func() {
err = multierr.Append(err, testIter.Close())
err = multierr.Append(err, oracleIter.Close())
if e := testIter.Close(); e != nil {
err = multierr.Append(err, errors.Errorf("test system failed: %s", err.Error()))
}
if e := oracleIter.Close(); e != nil {
err = multierr.Append(err, errors.Errorf("oracle failed: %s", err.Error()))
}
}()

testRows := loadSet(testIter)
Expand Down

0 comments on commit cd23da2

Please sign in to comment.