sbds_tests - Steem Blockchain Data Service Tests

Overview

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 sbds blockchain ingestion.
  • 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_json operations.
        • Accepts custom_json.id, e.g.:"params": {"tid": "follow"}
      • sbds.get_random_operation_block_nums
        • Returns random block_num values associated with the op_type.
      • sbds.get_random_operations
        • Returns random operations associated with the operation type.

sbds.get_random_operations

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.


Install

To use these Radiator tests:

Linux
$ sudo apt-get install ruby-full git openssl libssl1.0.0 libssl-dev
$ gem install bundler
macOS
$ gem install bundler

I'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 git@gist.github.com:86303fa429b6e0ea0cc2ec94a4b451ae.git sbds_tests
$ cd sbds_tests
$ bundle install

Upgrade

Typically, you can upgrade to the latest version by this command, from the original directory you cloned into:

$ git pull

Usually, 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.


Usage

To run the tests:

$ rake

Example 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 rake

And this will test a docker instance running on port 32769:

$ BASE_URL=http://localhost:32769 rake

Check 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

Get in touch!

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.

License

I don't believe in intellectual "property". If you do, consider sbds_tests as licensed under a Creative Commons CC0 License.

H2
H3
H4
Upload from PC
Video gallery
3 columns
2 columns
1 column
1 Comment