@@ -113,6 +113,7 @@ def self.integration(options = {})
113113 options [ :from_puppet_binary ] ||= OctocatalogDiff ::Spec ::PUPPET_BINARY
114114 options [ :to_puppet_binary ] ||= OctocatalogDiff ::Spec ::PUPPET_BINARY
115115 options [ :parallel ] = false if ENV [ 'COVERAGE' ]
116+ options [ :INTEGRATION ] = true
116117
117118 # Run octocatalog-diff CLI method. Capture stdout and stderr using 'strio'.
118119 # Set options[:RETURN_DIFFS] so that the .cli method returns the JSON array
@@ -124,28 +125,21 @@ def self.integration(options = {})
124125 stdout_strio = StringIO . new
125126 $stdout = stdout_strio
126127
127- # Tell OctocatalogDiff::Cli.cli to return the JSON differences and not a numeric exit code
128- # for a full catalog-diff.
129- options [ :RETURN_DIFFS ] = true
130-
131128 # Run the OctocatalogDiff::Cli.cli and validate output format.
132129 result = OctocatalogDiff ::Cli . cli ( argv , logger , options )
133- if result . is_a? ( Fixnum )
134- return {
135- logs : logger_string . string ,
136- output : stdout_strio . string ,
137- exitcode : result
138- }
139- end
140130
141- raise "OctocatalogDiff::Cli.cli should return array, got #{ result . inspect } " unless result . is_a? ( Array )
131+ unless result . is_a? ( OpenStruct )
132+ raise "Expected OpenStruct, got #{ result . inspect } from OctocatalogDiff::Cli.cli!"
133+ end
142134
143- # Return hash
144135 OpenStruct . new (
145136 logs : logger_string . string ,
137+ log_messages : logger_string . string . split ( /\n / ) . map { |x | OctocatalogDiff ::Spec . strip_log_message ( x ) } ,
146138 output : stdout_strio . string ,
147- diffs : result ,
148- exitcode : result . any? ? 2 : 0 ,
139+ diffs : result . diffs ,
140+ to : result . to ,
141+ from : result . from ,
142+ exitcode : result . diffs . any? ? 2 : 0 ,
149143 options : options
150144 )
151145 rescue => exc # Yes, rescue *everything*
0 commit comments