- Title: sbds_tests - Steem Blockchain Data Service Tests
- Tags: radiator ruby steem steemdev sbds
- Notes:
Here comes tests for sbds (Steem Blockchain Data Service), which is a project that is currently pre-release software and thus, not yet suitable for production use. See:
https://github.com/steemit/sbds
Even though it's just pre-release, it's already a great way to ingest the STEEM blockchain into a local database that any app can utilize.
These tests focus strictly on API access to verify ingestion. Current known routes offered by sbds:
GET https://sbds.steemitdev.com/health- Returns the current state of
sbdsblockchain ingestion.
- Returns the current state of
GET https://sbds.steemitdev.com/api/v1/blockchainStats- Returns basic statistics.
POST https://sbds.steemitdev.com/- JSON-RPC methods
sbds.count_operations- Not currently being tested.
sbds.get_custom_json_by_tid- Returns matching
custom_jsonoperations. - Accepts
custom_json.id, e.g.:"params": {"tid": "follow"}
- Returns matching
sbds.get_random_operation_block_nums- Returns random
block_numvalues associated with theop_type.
- Returns random
sbds.get_random_operations- Returns random operations associated with the operation type.
- JSON-RPC methods
The most important tests, at the moment, focus on this method. One tests takes all known op_type values and asks sbds for each of them. The random operations that are returned by sbds are then directly compared to the blockchain by querying the API with radiator.
This ensures that sbds a) correctly ingests the operation, and b) correctly reconstructs the operation from the database.
So far, it does this perfectly.
To use these Radiator tests:
$ sudo apt-get install ruby-full git openssl libssl1.0.0 libssl-dev
$ gem install bundler$ gem install bundlerI've tested it on various versions of ruby. The oldest one I got it to work was:
ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-darwin14.4.0]
First, clone this gist and install the dependencies:
$ git clone [email protected]:86303fa429b6e0ea0cc2ec94a4b451ae.git sbds_tests
$ cd sbds_tests
$ bundle installTypically, you can upgrade to the latest version by this command, from the original directory you cloned into:
$ git pullUsually, this works fine as long as you haven't modified anything. If you get an error, try this:
$ git stash --all
$ git pull --rebase
$ git stash pop
If you're still having problems, I suggest starting a new clone.
To run the tests:
$ rakeExample output:
Run options: --seed 54197
# Running:
..S.....
Fabulous run in 117.877599s, 0.0679 runs/s, 20.3601 assertions/s.
8 runs, 2400 assertions, 0 failures, 0 errors, 1 skips
You have skipped tests. Run with --verbose for details.
The tests will also look for ENV overrides, for example, this will effectively switch testing targets over to production:
$ BASE_URL=https://sbds.steemit.com NODE=https://steemd.steemit.co rakeAnd this will test a docker instance running on port 32769:
$ BASE_URL=http://localhost:32769 rakeCheck here to see an updated version of these tests:
https://gist.github.com/inertia186/86303fa429b6e0ea0cc2ec94a4b451ae

See my previous Ruby How To posts in: #radiator #ruby
If you're using sbds_tests, I'd love to hear from you. Drop me a line and tell me what you think! I'm @inertia on STEEM and SteemSpeak.
I don't believe in intellectual "property". If you do, consider sbds_tests as licensed under a Creative Commons 