Sha256: dce0919dd74e8ac11368db7c55eb3990f0bceccfe909f3abfb4673303decc08c

Contents?: true

Size: 1.43 KB

Versions: 16

Compression:

Stored size: 1.43 KB

Contents

#include <catch.hpp>
#include <facter/facts/collection.hpp>
#include <facter/facts/resolver.hpp>
#include <facter/facts/array_value.hpp>
#include <facter/facts/map_value.hpp>
#include <facter/facts/scalar_value.hpp>
#include "../../fixtures.hpp"
#include <sstream>

using namespace std;
using namespace facter::facts;
using namespace facter::testing;

SCENARIO("resolving external executable facts into a collection") {
    collection_fixture facts;
    REQUIRE(facts.size() == 0u);
    GIVEN("an absolute path") {
        facts.add_external_facts({
            LIBFACTER_TESTS_DIRECTORY "/fixtures/facts/external/posix/execution",
        });
        THEN("facts should resolve") {
            REQUIRE(facts.size() == 4u);
            REQUIRE(facts.get<string_value>("exe_fact1"));
            REQUIRE(facts.get<string_value>("exe_fact2"));
            REQUIRE_FALSE(facts.get<string_value>("exe_fact3"));
            REQUIRE(facts.get<string_value>("exe_fact4"));
            REQUIRE(facts.get<string_value>("foo"));
        }
    }
    GIVEN("a relative path") {
        test_with_relative_path fixture("foo", "bar", "#! /usr/bin/env sh\necho local_exec_fact=value");
        facts.add_external_facts({ "foo" });
        THEN("facts should resolve") {
            REQUIRE(facts.size() == 1u);
            REQUIRE(facts.get<string_value>("local_exec_fact"));
            REQUIRE(facts.get<string_value>("local_exec_fact")->value() == "value");
        }
    }
}

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
facter-3.12.2.cfacter.20181217 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.12.1.cfacter.20181031 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.11.6.cfacter.20181031 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.12.1.cfacter.20181023 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.11.5.cfacter.20181022 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.12.0.cfacter.20181004 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.12.0.cfacter.20181001 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.12.0.cfacter.20180918 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.11.4.cfacter.20180821 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.11.3.cfacter.20180716 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.11.2.cfacter.20180612 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.9.6.cfacter.20180612 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.11.2.cfacter.20180606 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.9.6.cfacter.20180606 ext/facter/facter/lib/tests/facts/posix/collection.cc
facter-3.11.0.cfacter.20180319 ext/facter/facter/lib/tests/facts/posix/collection.cc
cfacter-3.11.0.rc.20180314 ext/facter/facter/lib/tests/facts/posix/collection.cc