Skip to content

Commit

Permalink
Fix iter Host method (apache#2) (apache#918)
Browse files Browse the repository at this point in the history
* Fix iter Host method
  • Loading branch information
raphaelgavache authored and Zariel committed Jun 15, 2017
1 parent 3e8b36f commit ca7d339
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ Jesse Claven <jesse.claven@gmail.com>
Derrick Wippler <thrawn01@gmail.com>
Leigh McCulloch <leigh@leighmcculloch.com>
Ron Kuris <swcafe@gmail.com>
Raphael Gavache <raphael.gavache@gmail.com>
12 changes: 12 additions & 0 deletions cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,18 @@ func TestQueryStats(t *testing.T) {
}
}

// TestIterHosts confirms that host is added to Iter when the query succeeds.
func TestIterHost(t *testing.T) {
session := createSession(t)
defer session.Close()
iter := session.Query("SELECT * FROM system.peers").Iter()

// check if Host method works
if iter.Host() == nil {
t.Error("No host in iter")
}
}

//TestBatchStats confirms that the stats are returning valid data. Accuracy may be questionable.
func TestBatchStats(t *testing.T) {
if *flagProto == 1 {
Expand Down
1 change: 1 addition & 0 deletions query_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func (q *queryExecutor) executeQuery(qry ExecutableQuery) (*Iter, error) {

// Exit for loop if the query was successful
if iter.err == nil {
iter.host = host
return iter, nil
}

Expand Down

0 comments on commit ca7d339

Please sign in to comment.