Welcome to mirror list, hosted at ThFree Co, Russian Federation.

certificate_spec.rb « v2 « helm « kubernetes « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a3f0fd9eb9b36f20bb01718d6973cb7f24328311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true
require 'spec_helper'

RSpec.describe Gitlab::Kubernetes::Helm::V2::Certificate do
  describe '.generate_root' do
    subject { described_class.generate_root }

    it 'generates a root CA that expires a long way in the future' do
      expect(subject.cert.not_after).to be > 999.years.from_now
    end
  end

  describe '#issue' do
    subject { described_class.generate_root.issue }

    it 'generates a cert that expires soon' do
      expect(subject.cert.not_after).to be < 60.minutes.from_now
    end

    context 'passing in INFINITE_EXPIRY' do
      subject { described_class.generate_root.issue(expires_in: described_class::INFINITE_EXPIRY) }

      it 'generates a cert that expires a long way in the future' do
        expect(subject.cert.not_after).to be > 999.years.from_now
      end
    end
  end
end