debian-mirror-gitlab/spec/lib/gitlab/kubernetes/config_map_spec.rb

35 lines
1,003 B
Ruby
Raw Normal View History

2020-01-01 13:55:28 +05:30
# frozen_string_literal: true
2018-03-27 19:54:05 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::Kubernetes::ConfigMap do
2018-03-27 19:54:05 +05:30
let(:kubeclient) { double('kubernetes client') }
let(:application) { create(:clusters_applications_prometheus) }
2018-11-18 11:00:15 +05:30
let(:config_map) { described_class.new(application.name, application.files) }
2018-03-27 19:54:05 +05:30
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-11-18 11:00:15 +05:30
let(:resource) { ::Kubeclient::Resource.new(metadata: metadata, data: application.files) }
2020-01-01 13:55:28 +05:30
2018-03-27 19:54:05 +05:30
subject { config_map.generate }
2019-07-07 11:18:12 +05:30
it 'builds a Kubeclient Resource' do
2018-03-27 19:54:05 +05:30
is_expected.to eq(resource)
end
end
2018-11-18 11:00:15 +05:30
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-27 19:54:05 +05:30
end