{"action":"created","comment":{"url":"https://api.github.com/repos/btcsuite/btcd/pulls/comments/75426803","id":75426803,"diff_hunk":"@@ -0,0 +1,33 @@\n+rpctest\r\n+=======\r\n+\r\n+[![Build Status](https://travis-ci.org/btcsuite/btcd.png?branch=master)]\r\n+(https://travis-ci.org/btcsuite/btcd)\r\n+\r\n+Package rpctests provides a btcd-specific RPC testing harness crafting and executing integration tests by driving a `btcd` instance via the `RPC` interface. Each instance of a active harness comes equipped with a simple in-memory HD wallet capable of properly syncing to the generated chain, creating new addresses, and crafting fully signed transactions paying to an arbitrary set of outputs. \r\n+\r\n+This package was designed specifically to act as an RPC testing harness for `btcd`. However, the constructs presented are general enough to be adapted to any project wishing to programmatically drive a `btcd` instance of its systems/integration tests. \r\n+\r\n+## Documentation\r","path":"rpctest/README.md","position":11,"original_position":11,"commit_id":"2925fbd6bf40359007399e1bc5295f12f66cf9aa","original_commit_id":"2925fbd6bf40359007399e1bc5295f12f66cf9aa","user":{"login":"davecgh","id":2115102,"avatar_url":"https://avatars.githubusercontent.com/u/2115102?v=3","gravatar_id":"","url":"https://api.github.com/users/davecgh","html_url":"https://github.com/davecgh","followers_url":"https://api.github.com/users/davecgh/followers","following_url":"https://api.github.com/users/davecgh/following{/other_user}","gists_url":"https://api.github.com/users/davecgh/gists{/gist_id}","starred_url":"https://api.github.com/users/davecgh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davecgh/subscriptions","organizations_url":"https://api.github.com/users/davecgh/orgs","repos_url":"https://api.github.com/users/davecgh/repos","events_url":"https://api.github.com/users/davecgh/events{/privacy}","received_events_url":"https://api.github.com/users/davecgh/received_events","type":"User","site_admin":false},"body":"Would you make this match the new style with the rest of the project?  Namely this section was removed in favor a doc badge at the top.  Also they all have a badge for the license too (although the license section below wasn't removed).\r\n\r\n```\r\n [![ISC License]\r\n(http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)\r\n[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)]\r\n(http://godoc.org/github.com/btcsuite/btcd/rpctest)\r\n```","created_at":"2016-08-19T04:41:32Z","updated_at":"2016-08-19T04:41:32Z","html_url":"https://github.com/btcsuite/btcd/pull/371#discussion_r75426803","pull_request_url":"https://api.github.com/repos/btcsuite/btcd/pulls/371","_links":{"self":{"href":"https://api.github.com/repos/btcsuite/btcd/pulls/comments/75426803"},"html":{"href":"https://github.com/btcsuite/btcd/pull/371#discussion_r75426803"},"pull_request":{"href":"https://api.github.com/repos/btcsuite/btcd/pulls/371"}}},"pull_request":{"url":"https://api.github.com/repos/btcsuite/btcd/pulls/371","id":32787262,"html_url":"https://github.com/btcsuite/btcd/pull/371","diff_url":"https://github.com/btcsuite/btcd/pull/371.diff","patch_url":"https://github.com/btcsuite/btcd/pull/371.patch","issue_url":"https://api.github.com/repos/btcsuite/btcd/issues/371","number":371,"state":"open","locked":false,"title":"Create new rpctest packaged for rpc driven integration testing. ","user":{"login":"Roasbeef","id":998190,"avatar_url":"https://avatars.githubusercontent.com/u/998190?v=3","gravatar_id":"","url":"https://api.github.com/users/Roasbeef","html_url":"https://github.com/Roasbeef","followers_url":"https://api.github.com/users/Roasbeef/followers","following_url":"https://api.github.com/users/Roasbeef/following{/other_user}","gists_url":"https://api.github.com/users/Roasbeef/gists{/gist_id}","starred_url":"https://api.github.com/users/Roasbeef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roasbeef/subscriptions","organizations_url":"https://api.github.com/users/Roasbeef/orgs","repos_url":"https://api.github.com/users/Roasbeef/repos","events_url":"https://api.github.com/users/Roasbeef/events{/privacy}","received_events_url":"https://api.github.com/users/Roasbeef/received_events","type":"User","site_admin":false},"body":"This PR addresses #116 by creating a new package (`rpctest`) which provides functionality for writing automated black-box tests to exercise the RPC interface. \r\n\r\nAn instance of a `rpctest` consists of an active `btcd` process running in (typically) `--simnet` mode, a `btcrpcclient` instance connected to said node, and finally an embedded in-memory wallet instance (the `memWallet`) which manages any created coinbase outputs created by the mining `btcd` node. \r\n\r\nAs part of the `SetUp` process for an RPC test, a test author can optionally opt to have a test blockchain created. The second argument to `SetUp` dictates the number of mature coinbase outputs desired. The `btcd` process will then be directed to generate a test chain of length: `100 + numMatureOutputs`. \r\n\r\nThe embedded `memWallet` instance acts as a minimal, simple wallet for each `Harness` instance. The `memWallet` itself as a BIP 32 HD wallet capable of creating new addresses, creating fully signed transactions, creating+broadcasting a transaction paying to an arbitrary set of outputs, and querying the currently confirmed balance. \r\n\r\nIn order to extend the test change with blocks containing arbitrary transactions, one can use the `Generate` rpc call via the exposed `btcrpcclient `connected to the active `btcd` node. Additionally, the `Harness` also exposes a secondary block generation API allowing callers to create blocks with a set of hand-selected transaction, and an arbitrary `BlockVersion` or `Timestamp`. \r\n\r\nAfter execution of test logic `TearDown` should be called, allowing the test instance to clean up created temporary directories, and shut down the running processes. \r\n\r\nRunning multiple concurrent `rpctest.Harness` instances is supported in order to allow for test authors to exercise complex scenarios. As a result the primary interface to create, and initialize an `rpctest.Harness` instance is concurrent safe, with shared package level private global variables protected by a `sync.Mutex`. \r\n\r\nTo demo the new package I've written (basic) RPC tests for the following commands: \r\n   * `getbestblock`\r\n   * `getblockhash`\r\n   * `getblockcount`\r\n\r\nThe above tests are housed in a new file: `rpcserver_test.go` which utilizes `rpctest.Harness`, along with the `testing` package's new [`TestMain`](https://golang.org/pkg/testing/#hdr-Main) function. `TestMain` is utilized in order to maintain a higher degree of control over the test suite initialization, and tear down. At this point all created rpctests are housed within a single file, however as the package see more usage within `btcd`, we may opt to further split up generated tests within an internal package with an appropriate folder structure. \r\n\r\n<!-- Reviewable:start -->\r\n[<img src=\"https://reviewable.io/review_button.svg\" height=\"40\" alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/btcsuite/btcd/371)\r\n<!-- Reviewable:end -->\r\n","created_at":"2015-04-07T17:40:18Z","updated_at":"2016-08-19T04:41:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d462de16b3e1ab630a935890e81c2b57549ececb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/btcsuite/btcd/pulls/371/commits","review_comments_url":"https://api.github.com/repos/btcsuite/btcd/pulls/371/comments","review_comment_url":"https://api.github.com/repos/btcsuite/btcd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/btcsuite/btcd/issues/371/comments","statuses_url":"https://api.github.com/repos/btcsuite/btcd/statuses/2925fbd6bf40359007399e1bc5295f12f66cf9aa","head":{"label":"Roasbeef:rpc_test","ref":"rpc_test","sha":"2925fbd6bf40359007399e1bc5295f12f66cf9aa","user":{"login":"Roasbeef","id":998190,"avatar_url":"https://avatars.githubusercontent.com/u/998190?v=3","gravatar_id":"","url":"https://api.github.com/users/Roasbeef","html_url":"https://github.com/Roasbeef","followers_url":"https://api.github.com/users/Roasbeef/followers","following_url":"https://api.github.com/users/Roasbeef/following{/other_user}","gists_url":"https://api.github.com/users/Roasbeef/gists{/gist_id}","starred_url":"https://api.github.com/users/Roasbeef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roasbeef/subscriptions","organizations_url":"https://api.github.com/users/Roasbeef/orgs","repos_url":"https://api.github.com/users/Roasbeef/repos","events_url":"https://api.github.com/users/Roasbeef/events{/privacy}","received_events_url":"https://api.github.com/users/Roasbeef/received_events","type":"User","site_admin":false},"repo":{"id":21504517,"name":"btcd","full_name":"Roasbeef/btcd","owner":{"login":"Roasbeef","id":998190,"avatar_url":"https://avatars.githubusercontent.com/u/998190?v=3","gravatar_id":"","url":"https://api.github.com/users/Roasbeef","html_url":"https://github.com/Roasbeef","followers_url":"https://api.github.com/users/Roasbeef/followers","following_url":"https://api.github.com/users/Roasbeef/following{/other_user}","gists_url":"https://api.github.com/users/Roasbeef/gists{/gist_id}","starred_url":"https://api.github.com/users/Roasbeef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roasbeef/subscriptions","organizations_url":"https://api.github.com/users/Roasbeef/orgs","repos_url":"https://api.github.com/users/Roasbeef/repos","events_url":"https://api.github.com/users/Roasbeef/events{/privacy}","received_events_url":"https://api.github.com/users/Roasbeef/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Roasbeef/btcd","description":"An alternative full node bitcoin implementation written in Go (golang)","fork":true,"url":"https://api.github.com/repos/Roasbeef/btcd","forks_url":"https://api.github.com/repos/Roasbeef/btcd/forks","keys_url":"https://api.github.com/repos/Roasbeef/btcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Roasbeef/btcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Roasbeef/btcd/teams","hooks_url":"https://api.github.com/repos/Roasbeef/btcd/hooks","issue_events_url":"https://api.github.com/repos/Roasbeef/btcd/issues/events{/number}","events_url":"https://api.github.com/repos/Roasbeef/btcd/events","assignees_url":"https://api.github.com/repos/Roasbeef/btcd/assignees{/user}","branches_url":"https://api.github.com/repos/Roasbeef/btcd/branches{/branch}","tags_url":"https://api.github.com/repos/Roasbeef/btcd/tags","blobs_url":"https://api.github.com/repos/Roasbeef/btcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Roasbeef/btcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Roasbeef/btcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/Roasbeef/btcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Roasbeef/btcd/statuses/{sha}","languages_url":"https://api.github.com/repos/Roasbeef/btcd/languages","stargazers_url":"https://api.github.com/repos/Roasbeef/btcd/stargazers","contributors_url":"https://api.github.com/repos/Roasbeef/btcd/contributors","subscribers_url":"https://api.github.com/repos/Roasbeef/btcd/subscribers","subscription_url":"https://api.github.com/repos/Roasbeef/btcd/subscription","commits_url":"https://api.github.com/repos/Roasbeef/btcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/Roasbeef/btcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/Roasbeef/btcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/Roasbeef/btcd/issues/comments{/number}","contents_url":"https://api.github.com/repos/Roasbeef/btcd/contents/{+path}","compare_url":"https://api.github.com/repos/Roasbeef/btcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Roasbeef/btcd/merges","archive_url":"https://api.github.com/repos/Roasbeef/btcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Roasbeef/btcd/downloads","issues_url":"https://api.github.com/repos/Roasbeef/btcd/issues{/number}","pulls_url":"https://api.github.com/repos/Roasbeef/btcd/pulls{/number}","milestones_url":"https://api.github.com/repos/Roasbeef/btcd/milestones{/number}","notifications_url":"https://api.github.com/repos/Roasbeef/btcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Roasbeef/btcd/labels{/name}","releases_url":"https://api.github.com/repos/Roasbeef/btcd/releases{/id}","deployments_url":"https://api.github.com/repos/Roasbeef/btcd/deployments","created_at":"2014-07-04T18:01:29Z","updated_at":"2016-03-22T00:23:42Z","pushed_at":"2016-08-19T04:28:41Z","git_url":"git://github.com/Roasbeef/btcd.git","ssh_url":"git@github.com:Roasbeef/btcd.git","clone_url":"https://github.com/Roasbeef/btcd.git","svn_url":"https://github.com/Roasbeef/btcd","homepage":null,"size":17033,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"btcsuite:master","ref":"master","sha":"05ab7141d3b268e1479853a2f79e219d2db36428","user":{"login":"btcsuite","id":10235229,"avatar_url":"https://avatars.githubusercontent.com/u/10235229?v=3","gravatar_id":"","url":"https://api.github.com/users/btcsuite","html_url":"https://github.com/btcsuite","followers_url":"https://api.github.com/users/btcsuite/followers","following_url":"https://api.github.com/users/btcsuite/following{/other_user}","gists_url":"https://api.github.com/users/btcsuite/gists{/gist_id}","starred_url":"https://api.github.com/users/btcsuite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btcsuite/subscriptions","organizations_url":"https://api.github.com/users/btcsuite/orgs","repos_url":"https://api.github.com/users/btcsuite/repos","events_url":"https://api.github.com/users/btcsuite/events{/privacy}","received_events_url":"https://api.github.com/users/btcsuite/received_events","type":"Organization","site_admin":false},"repo":{"id":11931032,"name":"btcd","full_name":"btcsuite/btcd","owner":{"login":"btcsuite","id":10235229,"avatar_url":"https://avatars.githubusercontent.com/u/10235229?v=3","gravatar_id":"","url":"https://api.github.com/users/btcsuite","html_url":"https://github.com/btcsuite","followers_url":"https://api.github.com/users/btcsuite/followers","following_url":"https://api.github.com/users/btcsuite/following{/other_user}","gists_url":"https://api.github.com/users/btcsuite/gists{/gist_id}","starred_url":"https://api.github.com/users/btcsuite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btcsuite/subscriptions","organizations_url":"https://api.github.com/users/btcsuite/orgs","repos_url":"https://api.github.com/users/btcsuite/repos","events_url":"https://api.github.com/users/btcsuite/events{/privacy}","received_events_url":"https://api.github.com/users/btcsuite/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/btcsuite/btcd","description":"An alternative full node bitcoin implementation written in Go (golang)","fork":false,"url":"https://api.github.com/repos/btcsuite/btcd","forks_url":"https://api.github.com/repos/btcsuite/btcd/forks","keys_url":"https://api.github.com/repos/btcsuite/btcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/btcsuite/btcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/btcsuite/btcd/teams","hooks_url":"https://api.github.com/repos/btcsuite/btcd/hooks","issue_events_url":"https://api.github.com/repos/btcsuite/btcd/issues/events{/number}","events_url":"https://api.github.com/repos/btcsuite/btcd/events","assignees_url":"https://api.github.com/repos/btcsuite/btcd/assignees{/user}","branches_url":"https://api.github.com/repos/btcsuite/btcd/branches{/branch}","tags_url":"https://api.github.com/repos/btcsuite/btcd/tags","blobs_url":"https://api.github.com/repos/btcsuite/btcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/btcsuite/btcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/btcsuite/btcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/btcsuite/btcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/btcsuite/btcd/statuses/{sha}","languages_url":"https://api.github.com/repos/btcsuite/btcd/languages","stargazers_url":"https://api.github.com/repos/btcsuite/btcd/stargazers","contributors_url":"https://api.github.com/repos/btcsuite/btcd/contributors","subscribers_url":"https://api.github.com/repos/btcsuite/btcd/subscribers","subscription_url":"https://api.github.com/repos/btcsuite/btcd/subscription","commits_url":"https://api.github.com/repos/btcsuite/btcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/btcsuite/btcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/btcsuite/btcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/btcsuite/btcd/issues/comments{/number}","contents_url":"https://api.github.com/repos/btcsuite/btcd/contents/{+path}","compare_url":"https://api.github.com/repos/btcsuite/btcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/btcsuite/btcd/merges","archive_url":"https://api.github.com/repos/btcsuite/btcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/btcsuite/btcd/downloads","issues_url":"https://api.github.com/repos/btcsuite/btcd/issues{/number}","pulls_url":"https://api.github.com/repos/btcsuite/btcd/pulls{/number}","milestones_url":"https://api.github.com/repos/btcsuite/btcd/milestones{/number}","notifications_url":"https://api.github.com/repos/btcsuite/btcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/btcsuite/btcd/labels{/name}","releases_url":"https://api.github.com/repos/btcsuite/btcd/releases{/id}","deployments_url":"https://api.github.com/repos/btcsuite/btcd/deployments","created_at":"2013-08-06T18:10:52Z","updated_at":"2016-08-16T10:26:59Z","pushed_at":"2016-08-19T04:28:42Z","git_url":"git://github.com/btcsuite/btcd.git","ssh_url":"git@github.com:btcsuite/btcd.git","clone_url":"https://github.com/btcsuite/btcd.git","svn_url":"https://github.com/btcsuite/btcd","homepage":"https://github.com/btcsuite/btcd/blob/master/docs/README.md","size":17492,"stargazers_count":912,"watchers_count":912,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":242,"mirror_url":null,"open_issues_count":69,"forks":242,"open_issues":69,"watchers":912,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/btcsuite/btcd/pulls/371"},"html":{"href":"https://github.com/btcsuite/btcd/pull/371"},"issue":{"href":"https://api.github.com/repos/btcsuite/btcd/issues/371"},"comments":{"href":"https://api.github.com/repos/btcsuite/btcd/issues/371/comments"},"review_comments":{"href":"https://api.github.com/repos/btcsuite/btcd/pulls/371/comments"},"review_comment":{"href":"https://api.github.com/repos/btcsuite/btcd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/btcsuite/btcd/pulls/371/commits"},"statuses":{"href":"https://api.github.com/repos/btcsuite/btcd/statuses/2925fbd6bf40359007399e1bc5295f12f66cf9aa"}}}}
{"actor":{"display_login":"davecgh"}}