require 'vcloud'

module Vcloud
  module EdgeGateway
    class LoadBalancerConfigurationDiffer

        def initialize local, remote
          @local = local
          @remote = remote
        end

        def diff
          ( @local == stripped_remote_config ) ? [] : HashDiff.diff(@local, @remote)
        end

        def stripped_remote_config
          deep_cloned_remote_config = Marshal.load( Marshal.dump(@remote) )
          deep_cloned_remote_config[:Pool].each do |pool_entry|
            pool_entry.delete(:Operational)
          end
          deep_cloned_remote_config
        end

    end
  end

end

require 'vcloud'

module Vcloud
  module EdgeGateway
    class LoadBalancerConfigurationDiffer

        def initialize local, remote
          @local = local
          @remote = remote
        end

        def diff
          ( @local == stripped_remote_config ) ? [] : HashDiff.diff(@local, stripped_remote_config)
        end

        def stripped_remote_config
          deep_cloned_remote_config = Marshal.load( Marshal.dump(@remote) )
          if deep_cloned_remote_config.key?(:Pool)
            deep_cloned_remote_config[:Pool].each do |pool_entry|
              pool_entry.delete(:Operational)
            end
          end
          deep_cloned_remote_config
        end

    end
  end

end

Add unit tests for LoadBalancerConfigurationDiffer
Add unit tests for LoadBalancerConfigurationDiffer

This also highlighted that we were displaying the wrong output from the
diff: we were testing diff ok, but showing the HashDiff of the unstripped
destination
