Configure charlotte, give it a seed node, and it crawls the graph/tree of your services oriented architecture.
- python 3.8 available at
/usr/local/env python3
- python >= 3.7 was chosen in order to use python dataclasses
- python >= 3.8 was chosen in order to use unittest.mock AsyncMock
- dot/graphviz binaries installed in system PATH (e.g.
brew install graphviz
)
- Review the example project in examples/example-project
- Start a new project / empty folder
mkdir myitsybitsy && cd myitsybitsy
- `venv'
echo "git+ssh://[email protected]/life360/itsybitsy.git#egg=itsybitsy" > requirements.txt
pip install -r requirements.txt
- Configure charlotte - the configuration engine with which you will describe your service graph to itsybitsy
mkdir charlotte.d
- Create a/several
...CrawlStrategy.yaml
file(s).- Please see examples/ExampleSSHCrawlStrategy.yaml for example/documentation.
- Crate
web.yaml
file- "Providers", "skips" , and "Hints" are all defined in examples/web.yaml.
- Run
itsybitsy --help
for all available commands anditsybitsy spider --help
anditsybitsy render --help
for command specific configuration. - Disable builtin provider with the argument
--disable-providers ssh aws k8s
- Set any configurations which are known to be required for every run in
spider.conf
see ./examples/spider.conf.example - Hint:
spider.conf
is always inherited, but you can create different profiles such asspider.prod.conf
and reference them with the--profile
arg
Note: unlike the spider
command, render
is written to stand alone and parse the default json file in outputs/.lastrun.json
it requires no arguments by default.
$ itsybitsy spider -s ssh:$SEED_IP
foo [seed] (10.1.0.26)
|--HAP--? {ERR:TIMEOUT} UNKNOWN [port:80] (some-unreachable.host.local)
|--HAP--> mono [port:80/443] (10.0.0.123)
| |--NSQ--? {ERR:NULL_ADDRESS} UNKNOWN [some-multiplexor] (None)
It will by default render the "last run" automatically dumped to .lastrun.json. Or you can pass in -f
to load a specific file. The default renderer is ascii
unless a different render is passed in, as in --output graphviz
$ itsybitsy render
foo [seed] (10.1.0.26)
|--HAP--? {ERR:TIMEOUT} UNKNOWN [port:80] (some-unreachable.host.local)
|--HAP--> mono [port:80/443] (10.0.0.123)
| |--NSQ--? {ERR:NULL_ADDRESS} UNKNOWN [some-multiplexor] (None)
...
./itsybitsy --help
pytest
is used instead ofunittest
for more succinct test/reportingpytest-mock
is used for mocks, so you will see themocker
fixtures passed around magically for mocking. It is used in combination with the parameternew=sentinel.devnull
in order to not pass the patched mock to the test function.- Arrange, Act, Assert test style is used
- mocks are preferred for dependencies over production objects
- tests of objects are organized into a TestClass named after the object 1) for organization and 2) so that IDEs can find the test/subject relationship.
- tests are named in the following format:
"test_{name_of_function}_case_{description_of_case}"
- the string 'dummy' is used to indicate that a value is assigned solely to meet argument requirements, but unused otherwise
- fixtures are placed in conftest.py only if they are use in common between test packages, otherwise please keep them in the package they are used in
- the idiomatic references 'foo', 'bar', 'baz', 'buz', etc are used when passing stub values around. if you choose not to follow precedent: please use something obvious like 'stub1', 'stub2', etc
pytest
pytest --cov=water_spout tests
prospector --profile .prospector.yaml