2020-03-13 15:44:24 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::Kubernetes::TlsSecret do
|
2020-03-13 15:44:24 +05:30
|
|
|
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
|