Skip to content

Commit

Permalink
Merge pull request #2029 from kchristidis/fix-network-partitions-master
Browse files Browse the repository at this point in the history
Discovery: maintain and persist list of recent connections
  • Loading branch information
srderson committed Jun 28, 2016
2 parents f04b429 + 907315b commit 78fa375
Show file tree
Hide file tree
Showing 16 changed files with 659 additions and 407 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ linter: gotools
@echo "Running go vet"
go vet ./consensus/...
go vet ./core/...
go vet ./discovery/...
go vet ./events/...
go vet ./examples/...
go vet ./membersrvc/...
Expand Down
241 changes: 178 additions & 63 deletions bddtests/peer_basic.feature
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#
# Test Hyperledger Peers
# Test Fabric Peers
#
# Tags that can be used and will affect test internals:
#
# @doNotDecompose will NOT decompose the named compose_yaml after scenario ends. Useful for setting up environment and reviewing after scenario.
#
# @chaincodeImagesUpToDate use this if all scenarios chaincode images are up to date, and do NOT require building. BE SURE!!!

#@chaincodeImagesUpToDate
Feature: lanching 3 peers
As a HyperLedger developer
I want to be able to launch 3 peers
Feature: Network of Peers
As a Fabric developer
I want to run a network of peers

# @wip
Scenario: Peers list test, single peer issue #827
Expand Down Expand Up @@ -983,59 +981,6 @@ Feature: lanching 3 peers
Then I should get a JSON response from peers with "OK" = "80"
| vp0 | vp1 | vp2 |

# @doNotDecompose
# @wip
@issue_1874
Scenario: chaincode example02 with 4 peers, two stopped
Given we compose "docker-compose-4-consensus-batch.yml"
And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers:
| vp0 |
And I use the following credentials for querying peers:
| peer | username | secret |
| vp0 | test_user0 | MS9qrN8hFjlE |
| vp1 | test_user1 | jGlNl6ImkuDo |
| vp2 | test_user2 | zMflqOKezFiA |
| vp3 | test_user3 | vWdLCE00vJy0 |

When requesting "/chain" from "vp0"
Then I should get a JSON response with "height" = "1"

When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0"
| arg1 | arg2 | arg3 | arg4 |
| a | 100 | b | 200 |
Then I should have received a chaincode name
Then I wait up to "60" seconds for transaction to be committed to peers:
| vp0 | vp1 | vp2 |

When I query chaincode "example2" function name "query" with value "a" on peers:
| vp0 | vp1 | vp2 | vp3 |
Then I should get a JSON response from peers with "OK" = "100"
| vp0 | vp1 | vp2 | vp3 |

Given I stop peers:
| vp2 | vp3 |

When I invoke chaincode "example2" function name "invoke" on "vp0"
|arg1|arg2|arg3|
| a | b | 10 |
Then I should have received a transactionID

Given I start peers:
| vp3 |
And I wait "15" seconds

When I invoke chaincode "example2" function name "invoke" on "vp0" "9" times
|arg1|arg2|arg3|
| a | b | 10 |
Then I should have received a transactionID
Then I wait up to "60" seconds for transaction to be committed to peers:
| vp0 | vp1 | vp3 |

When I query chaincode "example2" function name "query" with value "a" on peers:
| vp0 | vp1 | vp3 |
Then I should get a JSON response from peers with "OK" = "0"
| vp0 | vp1 | vp3 |

#@doNotDecompose
# @wip
@issue_1873
Expand Down Expand Up @@ -1096,20 +1041,20 @@ Feature: lanching 3 peers

Given we compose "<ComposeFile>"
And I wait "2" seconds

When requesting "/network/peers" from "vp0"
Then I should get a JSON response with array "peers" contains "2" elements

Given I stop peers:
| vp0 |

When requesting "/network/peers" from "vp1"
Then I should get a JSON response with array "peers" contains "1" elements

Given I start peers:
| vp0 |
And I wait "5" seconds

When requesting "/network/peers" from "vp1"
Then I should get a JSON response with array "peers" contains "2" elements

Expand Down Expand Up @@ -1180,3 +1125,173 @@ Scenario: chaincode example02 with 4 peers, stop and start alternates, reverse
| vp0 | vp2 | vp3 |
Then I should get a JSON response from peers with "OK" = "977"
| vp0 | vp2 | vp3 |

@issue_1874a
#@doNotDecompose
Scenario: chaincode example02 with 4 peers, two stopped
Given we compose "docker-compose-4-consensus-batch.yml"
And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers:
| vp0 |
And I use the following credentials for querying peers:
| peer | username | secret |
| vp0 | test_user0 | MS9qrN8hFjlE |
| vp1 | test_user1 | jGlNl6ImkuDo |
| vp2 | test_user2 | zMflqOKezFiA |
| vp3 | test_user3 | vWdLCE00vJy0 |

When requesting "/chain" from "vp0"
Then I should get a JSON response with "height" = "1"

When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0"
| arg1 | arg2 | arg3 | arg4 |
| a | 100 | b | 200 |
Then I should have received a chaincode name
Then I wait up to "60" seconds for transaction to be committed to peers:
| vp0 | vp1 | vp2 |

When I query chaincode "example2" function name "query" with value "a" on peers:
| vp0 | vp1 | vp2 | vp3 |
Then I should get a JSON response from peers with "OK" = "100"
| vp0 | vp1 | vp2 | vp3 |

Given I stop peers:
| vp2 | vp3 |

When I invoke chaincode "example2" function name "invoke" on "vp0"
|arg1|arg2|arg3|
| a | b | 10 |
Then I should have received a transactionID

Given I start peers:
| vp3 |
And I wait "15" seconds

When I invoke chaincode "example2" function name "invoke" on "vp0" "9" times
|arg1|arg2|arg3|
| a | b | 10 |
Then I should have received a transactionID
Then I wait up to "60" seconds for transaction to be committed to peers:
| vp0 | vp1 | vp3 |

When I query chaincode "example2" function name "query" with value "a" on peers:
| vp0 | vp1 | vp3 |
Then I should get a JSON response from peers with "OK" = "0"
| vp0 | vp1 | vp3 |

@issue_1874b
#@doNotDecompose
Scenario: chaincode example02 with 4 peers, two stopped, bring back vp0
Given we compose "docker-compose-4-consensus-batch.yml"
And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers:
| vp0 |
And I use the following credentials for querying peers:
| peer | username | secret |
| vp0 | test_user0 | MS9qrN8hFjlE |
| vp1 | test_user1 | jGlNl6ImkuDo |
| vp2 | test_user2 | zMflqOKezFiA |
| vp3 | test_user3 | vWdLCE00vJy0 |

When requesting "/chain" from "vp0"
Then I should get a JSON response with "height" = "1"

When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0"
| arg1 | arg2 | arg3 | arg4 |
| a | 100 | b | 200 |
Then I should have received a chaincode name
Then I wait up to "60" seconds for transaction to be committed to peers:
| vp0 | vp1 | vp2 |

When I query chaincode "example2" function name "query" with value "a" on peers:
| vp0 | vp1 | vp2 | vp3 |
Then I should get a JSON response from peers with "OK" = "100"
| vp0 | vp1 | vp2 | vp3 |

Given I stop peers:
| vp0 |

And I register with CA supplying username "test_user1" and secret "jGlNl6ImkuDo" on peers:
| vp1 |

When I invoke chaincode "example2" function name "invoke" on "vp1"
|arg1|arg2|arg3|
| a | b | 10 |
Then I should have received a transactionID

Given I stop peers:
| vp3 |

When I invoke chaincode "example2" function name "invoke" on "vp1"
|arg1|arg2|arg3|
| a | b | 10 |
Then I should have received a transactionID

Given I start peers:
| vp0 |
And I wait "15" seconds

When I invoke chaincode "example2" function name "invoke" on "vp1" "8" times
|arg1|arg2|arg3|
| a | b | 10 |
Then I should have received a transactionID
Then I wait up to "60" seconds for transaction to be committed to peers:
| vp0 | vp1 | vp2 |

When I query chaincode "example2" function name "query" with value "a" on peers:
| vp0 | vp1 | vp2 |
Then I should get a JSON response from peers with "OK" = "0"
| vp0 | vp1 | vp2 |

@issue_1874c
#@doNotDecompose
Scenario: chaincode example02 with 4 peers, two stopped, bring back both
Given we compose "docker-compose-4-consensus-batch.yml"
And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers:
| vp0 |
And I use the following credentials for querying peers:
| peer | username | secret |
| vp0 | test_user0 | MS9qrN8hFjlE |
| vp1 | test_user1 | jGlNl6ImkuDo |
| vp2 | test_user2 | zMflqOKezFiA |
| vp3 | test_user3 | vWdLCE00vJy0 |

When requesting "/chain" from "vp0"
Then I should get a JSON response with "height" = "1"

When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0"
| arg1 | arg2 | arg3 | arg4 |
| a | 100 | b | 200 |
Then I should have received a chaincode name
Then I wait up to "60" seconds for transaction to be committed to peers:
| vp0 | vp1 | vp2 |

When I query chaincode "example2" function name "query" with value "a" on peers:
| vp0 | vp1 | vp2 | vp3 |
Then I should get a JSON response from peers with "OK" = "100"
| vp0 | vp1 | vp2 | vp3 |

Given I stop peers:
| vp1 | vp2 |

When I invoke chaincode "example2" function name "invoke" on "vp0" "1" times
|arg1|arg2|arg3|
| a | b | 10 |
Then I should have received a transactionID

Given I start peers:
| vp1 | vp2 |
And I wait "15" seconds

When I invoke chaincode "example2" function name "invoke" on "vp0" "8" times
|arg1|arg2|arg3|
| a | b | 10 |
Then I should have received a transactionID
Then I wait up to "60" seconds for transaction to be committed to peers:
| vp0 | vp1 | vp2 | vp3 |

Then I wait "30" seconds
# For the view to change to "vp3" or "vp1"

When I query chaincode "example2" function name "query" with value "a" on peers:
| vp0 | vp1 | vp2 | vp3 |
Then I should get a JSON response from peers with "OK" = "10"
| vp0 | vp1 | vp2 | vp3 |
49 changes: 0 additions & 49 deletions core/discovery.go

This file was deleted.

0 comments on commit 78fa375

Please sign in to comment.