Skip to content

Commit b6f7365

Browse files
author
Kevin Paulisse
committed
Add fixtures for ENC overrides
1 parent f9b9d30 commit b6f7365

8 files changed

Lines changed: 102 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
cat <<-EOF
4+
parameters:
5+
role: one
6+
EOF
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
:backends:
3+
- yaml
4+
:yaml:
5+
:datadir: /var/lib/puppet/environments/%{::environment}/hieradata
6+
:hierarchy:
7+
- roles/%{::role}
8+
- common
9+
:merge_behavior: deeper
10+
:logger: console
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
test::var_one: common
3+
test::var_two: common
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
test::var_one: one
3+
test::var_two: one
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
test::var_one: two
3+
test::var_two: two
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node default {
2+
include test
3+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class test (
2+
$var_one,
3+
$var_two = 'default',
4+
) {
5+
file { '/tmp/one':
6+
content => $var_one,
7+
}
8+
9+
file { '/tmp/two':
10+
content => $var_two,
11+
}
12+
13+
file { '/tmp/three':
14+
content => 'three',
15+
}
16+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# frozen_string_literal: true
2+
3+
require_relative 'integration_helper'
4+
5+
require 'json'
6+
7+
describe 'ENC override integration with no override' do
8+
before(:all) do
9+
@result = OctocatalogDiff::Integration.integration(
10+
spec_repo: 'enc-overrides',
11+
spec_fact_file: 'valid-facts.yaml',
12+
hiera_config: 'hiera.yaml',
13+
hiera_path: 'hieradata',
14+
argv: [
15+
'--enc',
16+
OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh')
17+
]
18+
)
19+
end
20+
21+
it 'should succeed' do
22+
expect(@result.exitcode).not_to eq(-1), OctocatalogDiff::Integration.format_exception(@result)
23+
expect(@result.exitcode).to eq(0), "Runtime error: #{@result.logs}"
24+
end
25+
26+
it 'should show no changes' do
27+
expect(@result.diffs).to eq([])
28+
end
29+
30+
it 'should contain proper resources in to-catalog' do
31+
to_catalog = @result.to
32+
expect(to_catalog).to be_a_kind_of(OctocatalogDiff::API::V1::Catalog)
33+
34+
file_one = to_catalog.resource(type: 'File', title: '/tmp/one')
35+
expect(file_one['parameters']['content']).to eq('one')
36+
37+
file_two = to_catalog.resource(type: 'File', title: '/tmp/two')
38+
expect(file_two['parameters']['content']).to eq('one')
39+
end
40+
41+
it 'should log proper messages' do
42+
expect(@result.log_messages).to include('DEBUG - Compiling catalogs for rspec-node.xyz.github.net')
43+
expect(@result.log_messages).to include('INFO - Catalogs compiled for rspec-node.xyz.github.net')
44+
expect(@result.log_messages).to include('INFO - No differences')
45+
end
46+
end
47+
48+
describe 'ENC override integration with --enc-override' do
49+
end
50+
51+
describe 'ENC override integration with --to-enc-override' do
52+
end
53+
54+
describe 'ENC override integration with --from-enc-override' do
55+
end
56+
57+
describe 'ENC override integration with catalog compilation only' do
58+
end

0 commit comments

Comments
 (0)