Lagom: first-time-bucket default value slows down tests.

Created on 4 Sep 2019  路  6Comments  路  Source: lagom/lagom

Lagom sets the default value of

cassandra-query-journal {
  first-time-bucket = "20160225T00:00"
}

An integration test running over a clean database takes quite some time to converge from that value to now(). We should document how to hack your unit tests to take that setting to a value that speed up test.

For example, I've set first-time-bucket = "20190903T00:00" on a test today shaving around 20 seconds (from 50sec to 30sec)!

Most helpful comment

For example, I've set first-time-bucket = "20190903T00:00" on a test today shaving around 20 seconds (from 50sec to 30sec)!

shaving around 20 seconds (from 50sec to 30sec)!

20 seconds

I will have two of these, please.

All 6 comments

For example, I've set first-time-bucket = "20190903T00:00" on a test today shaving around 20 seconds (from 50sec to 30sec)!

shaving around 20 seconds (from 50sec to 30sec)!

20 seconds

I will have two of these, please.

It probably should be documented for more than just tests, too. I think we've seen slow-downs in production caused by not customizing this. AFAIK the Lagom docs don't say anywhere that you should.

For our tests, we can simply override this property with now().

Of course, documenting for users this is very important as well.

AFAIK the Lagom docs don't say anywhere that you should.

It could be a good idea to make our seeds to set this to the current time when creating a new project as well (with the generated config pointing to the docs).

Could akka-persistence-cassandra do the now() if first-time-bucket is unset and the database is clean, and then that seed value be obtainable later? Seems silly to have a database at hand and have to record this in a file while generating a project (seeing as it's not a secret password-like thing).

maybe this was more than our own tests

Was this page helpful?
0 / 5 - 0 ratings