Cache certificate files in specs

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

The following discussion from gitlab-ce!31169 should be addressed:

  • @hfyngvason started a discussion:

    As I'm also sad to see the extra performance gains vanish, would caching these win you back the last bits of performance? We could read them into constants as so

    SAMPLE_KEY = File.read(Rails.root.join('spec/fixtures/clusters/sample_key.key')
    SAMPLE_CERT = File.read(Rails.root.join('spec/fixtures/clusters/sample_cert.pem')

    or maybe extend e.g. FixtureHelpers with something like

    def memoized_fixture_file(*args)
      FixtureHelpers.fixture_cache[*args] ||= fixture_file(*args)
    end
    
    def self.fixture_cache
      @fixture_cache ||= {}
    end
Edited Jun 30, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading