2020-02-05 04:08:43 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe Gitlab::Kubernetes::TlsSecret do
|
2020-02-05 04:08:43 -05:00
|
|
|
let(:secret) { described_class.new(name, cert, key, namespace) }
|
|
|
|
let(:name) { 'example-name' }
|
|
|
|
let(:cert) { 'example-cert' }
|
|
|
|
let(:key) { 'example-key' }
|
|
|
|
let(:namespace) { 'example-namespace' }
|
|
|
|
|
|
|
|
let(:data) do
|
|
|
|
{
|
|
|
|
'tls.crt': Base64.strict_encode64(cert),
|
|
|
|
'tls.key': Base64.strict_encode64(key)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#generate' do
|
|
|
|
subject { secret.generate }
|
|
|
|
|
|
|
|
let(:resource) do
|
|
|
|
::Kubeclient::Resource.new(
|
|
|
|
type: 'kubernetes.io/tls',
|
|
|
|
metadata: { name: name, namespace: namespace },
|
|
|
|
data: data
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to eq(resource) }
|
|
|
|
end
|
|
|
|
end
|