Skip to content

speed up unit tests#5137

Merged
johha merged 2 commits into
mainfrom
ident-slow-tests
Jun 15, 2026
Merged

speed up unit tests#5137
johha merged 2 commits into
mainfrom
ident-slow-tests

Conversation

@johha

@johha johha commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Split migration specs into a dedicated parallel_rspec batch, cache
runtime logs across runs, and tune the Postgres/MySQL CI services for
non-durable test workloads. Trim hot-spot specs (RSA key reuse, smaller
factories, fake clocks) and switch to targeted per-test truncation.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

@johha johha force-pushed the ident-slow-tests branch from bd940bf to c188e4f Compare June 2, 2026 15:10
@johha johha changed the title test: enable rspec --profile 20 for parallel unit tests speed up unit tests Jun 2, 2026
Split migration specs into a dedicated parallel_rspec batch, cache
runtime logs across runs, and tune the Postgres/MySQL CI services for
non-durable test workloads. Trim hot-spot specs (RSA key reuse, smaller
factories, fake clocks) and switch to targeted per-test truncation.
@johha johha force-pushed the ident-slow-tests branch from c188e4f to b4beaa7 Compare June 3, 2026 06:42
@johha johha marked this pull request as ready for review June 3, 2026 07:12
require 'cloud_controller/uaa/uaa_token_decoder'

# Generate RSA-2048 keys once and reuse across examples; key randomness is irrelevant here.
RSA_TEST_KEYS = Array.new(4) { OpenSSL::PKey::RSA.new(2048) }.freeze

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constant should either go into a more specific namespace (i.e. declaration inside the describe) or be set in a before(:all).

Comment thread spec/support/database_isolation.rb Outdated

# Sequel logger that records which tables an example wrote to, so we can truncate only those.
class WrittenTablesLogger
WRITE_REGEX = /\b(?:INSERT INTO|UPDATE|DELETE FROM|TRUNCATE TABLE|TRUNCATE)\s+[`"]?(\w+)/i

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regex only works for non-qualified table names - which is what Sequel normally uses. If someone would issue an INSERT INTO <schema>.<table>, we would not clean this up correctly.

@johha johha force-pushed the ident-slow-tests branch from f24e6e7 to 61cdb55 Compare June 15, 2026 13:28
@johha johha force-pushed the ident-slow-tests branch from 61cdb55 to 52fec34 Compare June 15, 2026 13:32
@johha johha requested a review from philippthun June 15, 2026 13:48
@johha johha merged commit 96a5a87 into main Jun 15, 2026
11 checks passed
@johha johha deleted the ident-slow-tests branch June 15, 2026 13:57
ari-wg-gitbot added a commit to cloudfoundry/capi-release that referenced this pull request Jun 15, 2026
Changes in cloud_controller_ng:

- speed up unit tests
    PR: cloudfoundry/cloud_controller_ng#5137
    Author: Johannes Haass <johannes.haass@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants