<commit_before># ROLE: primary-controller

require 'spec_helper'
require 'shared-examples'
manifest = 'astute/upload_cirros.pp'

describe manifest do
  shared_examples 'catalog' do

    let(:test_vm_image) { Noop.hiera_hash('test_vm_image') }
    it 'should contain upload_cirros class' do
      should contain_class('osnailyfacter::astute::upload_cirros')
    end

    it 'should wait for glance backends' do
      should contain_class('osnailyfacter::wait_for_glance_backends')
    end

    it 'should use glance_image provider' do
      should contain_glance_image(test_vm_image['img_name']).with(
        :ensure => 'present',
        :container_format => test_vm_image['container_format'],
        :disk_format => test_vm_image['disk_format'],
        :is_public => test_vm_image['public'],
        :min_ram => test_vm_image['min_ram'],
        :source => test_vm_image['img_path']
      )
    end

    it 'should have explicit ordering between LB classes and images' do
      expect(graph).to ensure_transitive_dependency("Haproxy_backend_status[glance-api]", "Glance_image[#{test_vm_image['img_name']}]")
      expect(graph).to ensure_transitive_dependency("Haproxy_backend_status[glance-registry]", "Glance_image[#{test_vm_image['img_name']}]")
    end
  end

  test_ubuntu_and_centos manifest
end<commit_msg>Add multiple image support to upload_cirros noop<commit_after># ROLE: primary-controller

require 'spec_helper'
require 'shared-examples'
manifest = 'astute/upload_cirros.pp'

describe manifest do
  shared_examples 'catalog' do

    let(:test_vm_images) { Noop.puppet_function 'flatten', [ Noop.hiera('test_vm_image') ] }
    let(:glance_images) { Noop.puppet_function 'generate_glance_images', test_vm_images }
    it 'should contain upload_cirros class' do
      should contain_class('osnailyfacter::astute::upload_cirros')
    end

    it 'should wait for glance backends' do
      should contain_class('osnailyfacter::wait_for_glance_backends')
    end

    it 'should use glance_image provider' do
      glance_images.each do |name,test_vm_image|
        should contain_glance_image(name).with(
          :ensure => 'present',
          :container_format => test_vm_image['container_format'],
          :disk_format => test_vm_image['disk_format'],
          :is_public => test_vm_image['is_public'],
          :min_ram => test_vm_image['min_ram'],
          :source => test_vm_image['source']
        )
      end
    end

    it 'should have explicit ordering between LB classes and images' do
      glance_images.each do |name,test_vm_image|
        expect(graph).to ensure_transitive_dependency("Haproxy_backend_status[glance-api]", "Glance_image[#{name}]")
        expect(graph).to ensure_transitive_dependency("Haproxy_backend_status[glance-registry]", "Glance_image[#{name}]")
      end
    end
  end

  test_ubuntu_and_centos manifest
end
{'fraction_non_alphanumeric': 0.10708057202650854, 'fraction_numerical': 0.0, 'mean_word_length': 4.320964749536178, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6535030', 'n_tokens_mistral': 930, 'n_tokens_neox': 907, 'n_words': 177}