2019-11-25 22:06:24 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-01 18:46:02 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe Gitlab::Kubernetes::ConfigMap do
|
2018-03-01 18:46:02 -05:00
|
|
|
let(:kubeclient) { double('kubernetes client') }
|
|
|
|
let(:application) { create(:clusters_applications_prometheus) }
|
2018-08-07 08:39:38 -04:00
|
|
|
let(:config_map) { described_class.new(application.name, application.files) }
|
2018-03-01 18:46:02 -05:00
|
|
|
let(:namespace) { Gitlab::Kubernetes::Helm::NAMESPACE }
|
|
|
|
|
|
|
|
let(:metadata) do
|
|
|
|
{
|
|
|
|
name: "values-content-configuration-#{application.name}",
|
|
|
|
namespace: namespace,
|
|
|
|
labels: { name: "values-content-configuration-#{application.name}" }
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#generate' do
|
2018-08-07 08:39:38 -04:00
|
|
|
let(:resource) { ::Kubeclient::Resource.new(metadata: metadata, data: application.files) }
|
2019-12-12 07:07:33 -05:00
|
|
|
|
2018-03-01 18:46:02 -05:00
|
|
|
subject { config_map.generate }
|
|
|
|
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'builds a Kubeclient Resource' do
|
2018-03-01 18:46:02 -05:00
|
|
|
is_expected.to eq(resource)
|
|
|
|
end
|
|
|
|
end
|
2018-06-25 05:57:29 -04:00
|
|
|
|
|
|
|
describe '#config_map_name' do
|
|
|
|
it 'returns the config_map name' do
|
|
|
|
expect(config_map.config_map_name).to eq("values-content-configuration-#{application.name}")
|
|
|
|
end
|
|
|
|
end
|
2018-03-01 18:46:02 -05:00
|
|
|
end
|