Of course, this testing is quite limited - you’ll want to expand on your tests in scan_test.py, as appropriate for your Microengine.
The PolySwarm marketplace is composed of a myriad of participants and technologies: Ethereum & IPFS nodes, contracts, Microengines, Ambassadors, Arbiters, artifacts and much more.
Testing a single component often demands availability of all of the other components.
The orchestration project makes standing up a complete testnet easy and seamless.
True to its name, orchestration orchestrates all the components necessary to stand up and tear down an entire PolySwarm marketplace environment on a local development machine.
Clone orchestration adjacent to your microengine-myeicarengine directory:
Let’s spin up a complete, working testnet to get a sense for what things should look like.
In the cloned orchestration directory:
$ docker-compose -f base.yml -f tutorial0.yml up
You’ll see output from the following services:
homechain: A geth node running our testnet’s “homechain”.
See Chains: Home vs Side for an explanation of our split-chain design.
sidechain: Another geth instance, this one running our testnet’s “sidechain”.
ipfs: An IPFS node responsible for hosting all artifacts in our development testnet.
polyswarmd: The PolySwarm daemon providing convenient access to the services offered by homechain, sidechain and ipfs.
contracts: Responsible for housing & deploying the PolySwarm Nectar (NCT) and BountyRegistry contracts onto our development testnet.
ambassador: A mock Ambassador (provided by polyswarm-client) that will place bounties on the EICAR file and on a file that is not EICAR.
arbiter: A mock Arbiter (provided by polyswarm-client) that will deliver Verdicts on “swarmed” artifacts, determining ground truth.
microengine: A mock Microengine (provided by polyswarm-client) that will investigate the “swarmed” artifacts and render Assertions.
Browse through the logs scroll on the screen to get a sense for what each of these components is doing.
Let it run for at least 5 minutes - it can take time to deploy contracts - and then the fun starts :)
When you’ve seen enough log output, do Ctrl-C to halt the development testnet gracefully.
Test Your Engine
Prior to testing, always check for updates to core PolySwarm Docker images. In the cloned orchestration project:
Next, let’s spin up our Microengine in a second terminal window in our microengine’s directory:
$ docker-compose -f docker/test-integration.yml up
Finally, let’s introduce some artifacts for our Microengine to scan in a third terminal window in the orchestration directory:
$ docker-compose -f base.yml -f tutorial0.yml up --no-deps ambassador
Take a look at the logs from all three terminal windows - you should see your Microengine responding to the Ambassador’s Bounties!
When you make changes to your Engine, testing those changes is as simple as re-building your Docker image and re-running the ambassador service to inject a new a new pair of EICAR/not-EICAR artifacts.
You can keep the rest of the testnet running while you iterate.