2018-08-07 08:39:38 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Gitlab::Kubernetes::Helm::Certificate do
|
|
|
|
describe '.generate_root' do
|
|
|
|
subject { described_class.generate_root }
|
|
|
|
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'generates a root CA that expires a long way in the future' do
|
2018-08-07 08:39:38 -04:00
|
|
|
expect(subject.cert.not_after).to be > 999.years.from_now
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#issue' do
|
|
|
|
subject { described_class.generate_root.issue }
|
|
|
|
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'generates a cert that expires soon' do
|
2018-08-07 08:39:38 -04:00
|
|
|
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) }
|
|
|
|
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'generates a cert that expires a long way in the future' do
|
2018-08-07 08:39:38 -04:00
|
|
|
expect(subject.cert.not_after).to be > 999.years.from_now
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|