Skip to content
Snippets Groups Projects

Mock data providers

Merged Dariusz Kędzierski requested to merge dk-mock-data-providers into develop
All threads resolved!

@ABW @bwrona Please take a look:

  • introduced two new classes: MockBlockProvider and MockVopsProvider
  • possibility to inject artificial data to block and vops using data from mock providers
  • data for mock providers is stored in json files, examples provided
  • added command line options to set paths for mock json files
  • provided path can also be a path to a directory. Direcotry will be scanned for json files and all json files from given directory will be loaded

I didn't want to mess with block streamer to much so:

  • blocks in json file must be in sequence, starting with block next to last one synced from hived,
  • json file must have three more blocks than required to fill the queue (just like in example file)
Edited by Dariusz Kędzierski

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Run example:

    time hive sync --steemd-url '{"default":"http://127.0.0.1:8090"}' --database-url postgresql://hive@localhost:5432/hive4 --mock-block-data-path mock_block_data_example.json

    After sync log into DB and check if there are accounts tester1 and tester2, also check if there is follow op with follower tester1 following tester2.

    dariusz-work@asgard:~/Sources/hivemind(dk-mock-data-providers [+])$ psql -U hive -d hive4
    psql (13.0 (Ubuntu 13.0-1.pgdg18.04+1), server 10.14 (Ubuntu 10.14-1.pgdg18.04+1))
    Type "help" for help.
    
    hive4=# select id from hive_accounts where name='tester1';
      id   
    -------
     92465
    (1 row)
    
    hive4=# select id from hive_accounts where name='tester2';
      id   
    -------
     92466
    (1 row)
    
    hive4=# select * from hive_follows where follower=92465 and following=92466;
       id   | follower | following | state |     created_at      | blacklisted | follow_blacklists | follow_muted | block_num 
    --------+----------+-----------+-------+---------------------+-------------+-------------------+--------------+-----------
     457074 |    92465 |     92466 |     1 | 2016-09-15 19:47:24 | f           | f                 | f            |   5000002
    (1 row)
    
    hive4=# 

    Note artificial block with number 5000002

    Edited by Dariusz Kędzierski
  • added To Do label

  • added 1 commit

    • 2cbc67e7 - Cleanup in mock classes, mock logic moved from block stream to client.py, mock...

    Compare with previous version

  • Dariusz Kędzierski resolved all threads

    resolved all threads

  • Working on support for multiple mock files.

  • Dariusz Kędzierski marked as a Work In Progress

    marked as a Work In Progress

  • added 1 commit

    • 7d46be91 - Load from directory support. Bug fixes

    Compare with previous version

  • Dariusz Kędzierski added Review label and removed To Do label

    added Review label and removed To Do label

  • Dariusz Kędzierski unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Dariusz Kędzierski changed the description

    changed the description

  • added 24 commits

    Compare with previous version

  • added 1 commit

    • d56addb4 - Minor cleanup: Removed unused imports/variables.

    Compare with previous version

  • merged

  • Bartek Wrona mentioned in commit d35621ee

    mentioned in commit d35621ee

  • Please register or sign in to reply
    Loading