Trendyol/stove

Support testcontainer-less TestSystem

oguzhaneren opened this issue · 3 comments

When using stove in pipelines, we faced some infrastructural issues like image errors, timeout, slow startup time, high memory and cpu usage.

To solve this kind of issues we decide use Stove with shared environments instead of DiD. If we can pass our environment configurations to Stove, Stove doesn't need boot testcontainers any more.

so we need to pass our shared environment configs to Stove like following.

TestSystem("http://localhost:8001").with {
            bridge()
            couchbase {
                CouchbaseSystemOptions.fromInstance("http://localhost:8089","username","password","defaultBucket)
            }
            kafka {
                KafkaSystemOptions.fromInstance("localhost:9001",objectMapper)
            }
        }.run()
    }

with this implementation we can continue to use Stove without any breaking change in tests, we need to change only Test setup.

That makes sense, and quite similar to what we have already:

TestSystem(baseUrl = "http://localhost:8001") {
    if (isRunningLocally()) {
        enableReuseForTestContainers()
        keepDendenciesRunning() // this will keep the dependencies running after the tests are finished
    }
}

There are some points to think about from top of my head:

  • What about test migrations? Do we assume that they are run already? We should provide options to always-run: false | true migration when running against existing infra.
  • Should not mix with isRunningLocally, or at least if both are configured the local one should take precedence.

That makes sense, and quite similar to what we have already:

TestSystem(baseUrl = "http://localhost:8001") {
    if (isRunningLocally()) {
        enableReuseForTestContainers()
        keepDendenciesRunning() // this will keep the dependencies running after the tests are finished
    }
}

There are some points to think about from top of my head:

  • What about test migrations? Do we assume that they are run already? We should provide options to always-run: false | true migration when running against existing infra.
  • Should not mix with isRunningLocally, or at least if both are configured the local one should take precedence.
  • I think we can continue to support migrations because we continue to create buckets and topics from e2e code base.
  • reusable containers are not suitable (https://java.testcontainers.org/features/reuse/) for CI pipelines but we can use at local, so it would be good if we support both type, instance or resuable

ReadySystem requirements:

Approach 1

Adding a new type of SystemOptions, called ReadySystemOptions, corresponding systems

  • {SystemName}ReadySytemOptions: CouchbaseReadySytemOptions, KafkaReadySystemOptions

  • Migrations can run as is

  • Ready system Healthcheck callback

  • StateOfSystem can stay as is, it looks.

Approach 2

  • No need to introduce a new SystemOptions
  • migrations run as is
  • StateStore can be implemented, could be Gitlab, ElasticSearch, a document DB, etc, user can simply implement it.

Ehancements

  • ShudownHook can be implemented to clear all the data for the related TestSystem