You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: spec_helper_tls.rb
    path of file: ./repos/puppet-elasticsearch/spec
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require 'openssl'

def gen_certs(num_certs, path)
  ret = { clients: [] }
  serial = 1_000_000
  ca_key = OpenSSL::PKey::RSA.new 2048

  # CA Cert
  ca_name = OpenSSL::X509::Name.parse 'CN=ca/DC=example/DC=com'
  ca_cert = OpenSSL::X509::Certificate.new
  ca_cert.serial = serial
  serial += 1
  ca_cert.version = 2
  ca_cert.not_before = Time.now
  ca_cert.not_after = Time.now + 86_400
  ca_cert.public_key = ca_key.public_key
  ca_cert.subject = ca_name
  ca_cert.issuer = ca_name
  extens
    
def gen_certs(num_certs, path)
  ret = { clients: [] }
  serial = 1_000_000
  ca_key = OpenSSL::PKey::RSA.new 2048

  # CA Cert
  ca_name = OpenSSL::X509::Name.parse 'CN=ca/DC=example/DC=com'
  ca_cert = OpenSSL::X509::Certificate.new
  ca_cert.serial = serial
  serial += 1
  ca_cert.version = 2
  ca_cert.not_before = Time.now
  ca_cert.not_after = Time.now + 86_400
  ca_cert.public_key = ca_key.public_key
  ca_cert.subject = ca_name
  ca_cert.issuer = ca_name
  extension_factory = OpenSSL::X509::ExtensionFactory.new
  extension_factory.subject_certificate = ca_cert
  extension_factory.issuer_certificate = ca_cert
  # ca_cert.add_extension extension_factory.create_extension(
  #   'subjectAltName', ['localhost', '127.0.0.1'].map { |d| "DNS: #{d}" }.join(',')
  # )
  ca_cert.add_extension extension_factory.create_extension(
    'subjectKeyIdentifier', 'hash'
  )
  ca_cert.add_extension extension_factory.create_extension(
    'basicConstraints', 'CA:TRUE', true
  )
  ca_cert.sign ca_key, OpenSSL::Digest.new('SHA256')
  ret[:ca] = {
    cert: {
      pem: ca_cert.to_pem,
      path: "#{path}/ca_cert.pem"
    }
  }

  num_certs.times do |i|
    key, cert, serial = gen_cert_pair serial, ca_cert
    cert.sign ca_key, OpenSSL::Digest.new('SHA256')
    ret[:clients] << {
      key: {
        pem: key.to_pem,
        path: "#{path}/#{i}_key.pem"
      },
      cert: {
        pem: cert.to_pem,
        path: "#{path}/#{i}_cert.pem"
      }
    }
  end

  ret
end