Dev Useful Stuff
2.02K subscribers
2 photos
337 links
Here you can find some interesting links to development libraries, frameworks, tools, plugins and articles
Download Telegram
​​Testcontainers recently passed over 1000 stars threshold. It is an perfect reason to pen a post about this utterly useful library.

Intro

When you write unit-tests for your code, you usually mock all the external dependencies, such as database calls or message queue polling. But what if you need to make integration tests with real dependencies? Usually, it is quite tricky, because in this case, you have to have real services installed in your system, which is not very convenient. Say, you want to write integration tests working with a database, in this situation you need a real database running on your local machine.

As you can see, it is kind of a problem and not flexible at all, because you run tests on other developers computers and CI servers and all these guys also need to run the database to make tests passing. Is there any convenient solution?

Solution

Introducing Testcontainers (★ 1006). This java-library allows you to set up your dependencies right from your integration tests using Docker containers. Your tests remain independent of other services because each test set up an individual environment for its runtime.

Look how easy to use it. Say, you need a Redis for your test, then you add the class rule like so:

// Set up a redis container
@ClassRule
public static GenericContainer redis =
new GenericContainer("redis:3.0.2")
.withExposedPorts(6379);


and a spare Redis will be available for your tests on the 6379 port.

Please, refer to official documentation for more examples. This library also exists as a plugin for Spock framework and Scala tests.

#java #docker #tests #container #spock #scala
​​Firecracker - (★ 25.8k) is an open source virtualization technology that is purpose-built for creating and managing secure, multi-tenant container and function-based services.

Firecracker enables you to deploy workloads in lightweight virtual machines, called microVMs, which provide enhanced security and workload isolation over traditional VMs, while enabling the speed and resource efficiency of containers. Firecracker was developed at Amazon Web Services to improve the customer experience of services like AWS Lambda and AWS Fargate .

Firecracker is a virtual machine monitor (VMM) that uses the Linux Kernel-based Virtual Machine (KVM) to create and manage microVMs. Firecracker has a minimalist design. It excludes unnecessary devices and guest functionality to reduce the memory footprint and attack surface area of each microVM. This improves security, decreases the startup time, and increases hardware utilization. Firecracker is generally available on 64-bit Intel, AMD and Arm CPUs with support for hardware virtualization.

#virtualization #container #vm
👍32🔥1
​​oxker - (★ 1.1k) a yet another simple tui to view & control docker containers.

(similar projects are lazydocker, as well as dockly and ctop)

#docker #tui #rust #container #console #terminal
👏2