def run_puppet(driver_instance, puppet_tests, logger:nil, reset_after_run:true)
      # use supplied logger in preference to the default puppetbox logger instance
      logger = logger || @logger
      logger.debug("#{driver_instance.node_name} running #{puppet_tests.size} tests")

      if driver_instance.open
        logger.debug("#{driver_instance.node_name} started")
        if driver_instance.self_test
          logger.debug("#{driver_instance.node_name} self_test OK, running puppet")
          puppet_tests.each { |test_name, puppet_code|
            if @result_set.class_size(driver_instance.node_name) > 0 and reset_after_run
              # purge and reboot the vm - this will save approximately 1 second
              # per class on the self-test which we now know will succeed
              driver_instance.reset
            end
            setup_test(driver_instance, test_name)
            logger.info("running test #{driver_instance.node_name} - #{test_name}")

            # write out the local test file
            relative_puppet_file = commit_testcase(
              puppet_tests, driver_instance.node_name, test_name
            )
            driver_instance.sync_testcase(driver_instance.node_name, test_name)

            puppet_file_remote = File.join(PUPPET_TESTCASE_DIR, relative_puppet_file)
            driver_instance.run_puppet_x2(puppet_file_remote)
            @logger.debug("Saved result #{driver_instance.node_name} #{test_name} #{driver_instance.result.passed?}")
            @result_set.save(driver_instance.node_name, test_name, driver_instance.result)

            Report::log_test_result_or_errors(
              @logger,
              driver_instance.node_name,
              test_name,
              driver_instance.result,
            )
          }
          logger.debug("#{driver_instance.node_name} test completed, closing instance")
        else
          raise "#{driver_instance.node_name} self test failed, unable to continue"
        end
      else
        raise "#{driver_instance.node_name} failed to start, unable to continue"
      end

      driver_instance.close
    end
def run_puppet(driver_instance, puppet_tests, logger:nil, reset_after_run:true)
      # use supplied logger in preference to the default puppetbox logger instance
      logger = logger || @logger
      logger.debug("#{driver_instance.node_name} running #{puppet_tests.size} tests")

      if driver_instance.open
        logger.debug("#{driver_instance.node_name} started")
        if driver_instance.self_test
          logger.debug("#{driver_instance.node_name} self_test OK, running puppet")
          puppet_tests.each { |test_name, puppet_code|
            if @result_set.class_size(driver_instance.node_name) > 0 and reset_after_run
              # purge and reboot the vm - this will save approximately 1 second
              # per class on the self-test which we now know will succeed
              driver_instance.reset
            end
            setup_test(driver_instance, test_name)
            logger.info("running test #{driver_instance.node_name} - #{test_name}")

            # write out the local test file
            relative_puppet_file = commit_testcase(
              puppet_tests, driver_instance.node_name, test_name
            )
            driver_instance.sync_testcase(driver_instance.node_name, test_name)

            puppet_file_remote = File.join(PUPPET_TESTCASE_DIR, relative_puppet_file)
            driver_instance.run_puppet_x2(puppet_file_remote)
            @logger.debug("Saved result #{driver_instance.node_name} #{test_name} #{driver_instance.result.passed?}")
            @result_set.save(driver_instance.node_name, test_name, driver_instance.result)

            Report::log_test_result_or_errors(
              @logger,
              driver_instance.node_name,
              test_name,
              driver_instance.result,
            )
          }
          logger.debug("#{driver_instance.node_name} test completed, closing instance")
        else
          raise "#{driver_instance.node_name} self test failed, unable to continue"
        end
      else
        raise "#{driver_instance.node_name} failed to start, unable to continue"
      end

      driver_instance.close
    end
Run puppet using `driver_instance` to execute `puppet_codes`
 @param puppet_test Hash of test names <-> puppet code, eg {"apache"=>"include apache","nginx"=>"include nginx"}}