CityOfZion / neo-sharp

Neo-sharp is a new core and node implementation of NEO focused on modular design, best coding practices and testability.
MIT License
34 stars 24 forks source link

Integration tests infrastructure (with docker containers) #274

Closed aboimpinto closed 6 years ago

aboimpinto commented 6 years ago

I wish with a simple command roll out an infrastructure to run several scenarios of integration tests.

Using Docker containers, it's possible to roll out nodes with different configurations living in the same network.

The different node configuration are:

All this nodes can be connected to an existing network (testnet for example) or in a stand-alone network.

Another case test is roll out several nodes and guarantee all synchronization is done and start killing nodes and make sure the network still function.

With this infrastructure there should be possible to imagine tests like: stress tests with different node configuration, smart contract roll out tests, etc.

nunojusto commented 6 years ago

I'm working on this. I will start with Linux using docker-compose and multi docker containers, to run the compilation and then the compiled app to be tested.

shargon commented 6 years ago

We can use RPC calls for get the results https://github.com/CityOfZion/neo-sharp/pull/269

aboimpinto commented 6 years ago

Yes .. I think we should use the current infrastructure to show the results, to invoke transactions or SmartContracts

nunojusto commented 6 years ago

An assembly specified in the application dependencies manifest (NeoSharp.Application.deps.json) was not found: package: 'BouncyCastle.NetCore', version: '1.8.2' path: 'lib/netstandard2.0/BouncyCastle.Crypto.dll'

This is working in the first container I've built including DotNet SDK.

Does anyone know how to install BouncyCastle.NetCore not using the SDK? I'm trying to build a small/light container only with dotnet runtime and without all the things SDK brings.

shargon commented 6 years ago

Did you try with dist: xenial ?

nunojusto commented 6 years ago

I'm using official microsoft containers for security reasons : https://hub.docker.com/r/microsoft/dotnet/ But maybe we cannot use only the runtime for this. I will leave it for better days. SDK container is running fine compiling and installing all in 30 seconds.

I need now to know what kind of tests are needed. @aboimpinto please reach me when possible.

aboimpinto commented 6 years ago

for the tests and Sync with the MainNet and TestNet it's better to talk to @shargon. He already have some experience sync with the actual network. Would be nice to integrate those tests in this set of integration tests.

aboimpinto commented 6 years ago

@shargon for the begin, when me and @nunojusto talked about this containers, we took the road of using the official containers for .NET for Windows and Linux. For the development environment it's Ok to have SDK installed because mean Software Development Kit. In the production environment the SDK should not be installed and only the Runtime version of the software because of space and for security reasons.

Said that, doesn't mean that we find that we need to install the SDK in production environment but if we can avoid ... we will.

The same with the containers .. we will try to use the official version of it ... if we find another version, slimmer and do that same, we will consider to support that too.

What do you think?

shargon commented 6 years ago

I think everything you say is accurate, you have to use only Runtimes in production

nunojusto commented 6 years ago

Yes, there are advantages to use only runtime, like:

And with containers you can run more than one node (neo-sharp) in parallel and anytime you run it it will be a clean initial environment.

nunojusto commented 6 years ago

Let me say that I've made it !!! It's running solely on runtime.

Docker runtime container (debian) = 337 MB Published NeoSharp.Application (with all deps) = 110MB

So, for now it's running on runtime with only 447MB storage space and using only 24.41MiB RAM (neo-sharp idle prompt). I will PR my work very soon. I just need to write a good Readme explaining how to run/build this.

PS. Then I will try to optimize it and use, instead of debian linux, the alpine linux which is the most light linux ever.

nunojusto commented 6 years ago

PR submitted