Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix win acceptance tests - 3.21.x #5325

Merged
merged 4 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ bundle agent init
running with dry-run.";
}

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10217" };
}

bundle agent check
{
vars:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ bundle agent init

bundle agent test
{
meta:
"test_suppress_fail" string => "windows",
meta => { "redmine4730" };
}

bundle agent check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ bundle agent init

bundle agent test
{
meta:
"test_suppress_fail" string => "windows",
meta => { "redmine4730" };
}

bundle agent check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@ bundle common inventory
!this_is_true::
"inputs" slist => { };
"bundles" slist => { "bad" };
this_is_true::
this_is_true.!windows::
"inputs" slist => { "$(this.promise_filename).sub" };
"bundles" slist => { "good" };
windows::
"bundles" slist => { "skip" };
}

bundle agent bad
{
reports:
"$(this.promise_filename) FAIL";
}

bundle agent skip
{
reports:
"$(this.promise_filename) Skip/unsupported";
}
3 changes: 3 additions & 0 deletions tests/acceptance/00_basics/04_bundles/namespaced.cf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ bundle agent init

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10257" };
}

bundle agent check
Expand Down
8 changes: 6 additions & 2 deletions tests/acceptance/00_basics/def.json/bad-json.cf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ body common control

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10257" };

methods:
"" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)/def.json");
"" usebundle => file_copy("$(this.promise_filename).json", "$(sys.inputdir)$(const.dirsep)def.json");
}

#######################################################
Expand All @@ -22,5 +26,5 @@ bundle agent check
"command" string => "$(sys.cf_promises) -v|$(G.grep) JSON";

methods:
"" usebundle => dcs_passif_output(".*Could not parse JSON file $(sys.inputdir)/def.json.*", "", $(command), $(this.promise_filename));
"" usebundle => dcs_passif_output(".*Could not parse JSON file $(sys.inputdir)$(const.dirsep)def.json.*", "", $(command), $(this.promise_filename));
}
6 changes: 6 additions & 0 deletions tests/acceptance/00_basics/def.json/state.cf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ body common control

#######################################################

bundle agent test
{
}

#######################################################

bundle agent check
{
methods:
Expand Down
13 changes: 9 additions & 4 deletions tests/acceptance/00_basics/macros/if_triple.cf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
######################################################
#
# Test that @if works with patch level
#
#####################################################

body common control
Expand All @@ -13,7 +12,7 @@ body common control
bundle agent init
{
files:
"$(G.testdir)/test.cf"
"$(G.testdir)$(const.dirsep)test.cf"
create => "true",
edit_template => "$(this.promise_filename).sub.template",
template_method => "mustache";
Expand All @@ -22,9 +21,15 @@ bundle agent init
bundle agent check
{
methods:
"check" usebundle => dcs_passif_output(".*$(G.testdir)/test.cf Pass.*",
# Note: dcs_passif_output expects first argument to be regexp.
# To convert Windows-style path (with backslashes) to a regex which will match this path,
# we need to convert all backslashes to double-backslashes.
# In the command below, each backslash is escaped twice:
# once for regex, and once for CFEngine string parser.
"check" usebundle => dcs_passif_output(regex_replace(".*$(G.testdir)$(const.dirsep)test.cf Pass.*",
"\\\\", "\\\\\\\\", "g"),
".*FAIL.*",
"$(sys.cf_agent) -D AUTO -Kf $(G.testdir)/test.cf",
"$(sys.cf_agent) -D AUTO -Kf $(G.testdir)$(const.dirsep)test.cf",
$(this.promise_filename));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ bundle agent __main__
"bundlesequence" usebundle => default("$(this.promise_filename)");
}

bundle agent init
{
commands:
windows::
"$(G.dos2unix) $(this.promise_dirname)/expected_output.txt" -> { "ENT-10433" };
}

bundle agent test
{
meta:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ bundle agent __main__
"bundlesequence" usebundle => default("$(this.promise_filename)");
}

bundle agent init
{
commands:
windows::
"$(G.dos2unix) $(this.promise_dirname)/expected_output.txt" -> { "ENT-10433" };
}

bundle agent test
{
meta:
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/01_vars/01_basic/sysvars.cf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ bundle agent init

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10257" };
}

#######################################################
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/01_vars/02_functions/execresult.cf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ bundle agent init

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10217" };
vars:
"dummy" string => "dummy";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ bundle agent test
meta:
"description" -> {"ENT-7478"}
string => "If 'ifelapsed => 0' is used, execresult() should run the given command every time";
"test_soft_fail" string => "windows",
meta => { "ENT-10217" };

methods:
"foo" usebundle => check_date("foo");
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/01_vars/02_functions/execresult_select.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ bundle agent test
meta:
"description" -> { "CFE-3108" }
string => "Test that you can select stderr/stdout in execresult";
"test_soft_fail" string => "windows",
meta => { "ENT-10217" };

vars:
"result_with_stdout_stderr"
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/01_vars/02_functions/execresult_stderr.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ bundle agent test
meta:
"description" -> { "CFE-3103" }
string => "Test that execresult captures both stdout and stderr";
"test_soft_fail" string => "windows",
meta => { "ENT-10217" };

vars:
"result_with_stdout_stderr"
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/01_vars/02_functions/findfiles.cf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bundle agent test
{
meta:
"test_suppress_fail" string => "windows",
meta => { "redmine4730" };
meta => { "redmine4730,ENT-2145" };

vars:
"patterns[a]" string => "$(G.testdir)/?";
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/01_vars/02_functions/findfiles_up.cf
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ bundle agent test
meta:
"description" -> { "CFE-3577" }
string => "Test for expected results from policy function search_up";
"test_skip_needs_work" string => "windows",
meta => { "ENT-10250" };

methods:
"Test 0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ bundle agent init

bundle agent test
{
meta:
"test_soft_fail" string => "!any",
meta => { "redmine7116" };

vars:
"values_data_1" slist => getindices("init.data[bar]");
"values_data_2" slist => getindices("init.data[zebra][lion]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ bundle agent init

bundle agent test
{
meta:
"test_soft_fail" string => "!any",
meta => { "redmine7116" };

vars:
# expected: one, two
"values_data" slist => getindices("init.data[bar]");
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/01_vars/02_functions/getuserinfo.cf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ body common control

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10217" };
vars:
# this is pretty much all we can test across platforms
"info_root" string => nth(getuserinfo("root"), "username");
Expand Down
1 change: 0 additions & 1 deletion tests/acceptance/01_vars/02_functions/nth_datacontainer.cf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ bundle agent init
bundle common test_common
{
vars:

"data" data => readjson("$(this.promise_filename).json", "100k");
"datastr" string => format("%S", data);

Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance/01_vars/02_functions/readdata.cf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ body common control

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10252" };

vars:
"explicit_csv" data => readdata("$(this.promise_filename).csv", "CSV");
"explicit_env" data => readdata("$(this.promise_filename).env", "ENV");
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/01_vars/02_functions/shuffle-exact.cf
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ bundle agent test
# for some reason, shuffle() produces different results on 64bit RHEL 4
# and Debian 4 than everywhere else
"test_soft_fail"
string => "(centos_4|centos_5|debian_4).64_bit",
meta => { "CFE-2301" };
string => "((centos_4|centos_5|debian_4).64_bit)|windows",
meta => { "CFE-2301,ENT-10254" };
vars:
"lists" slist => { "a", "b" };
"seeds" slist => { "skruf", "cormorant", "dollhouse" };
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/01_vars/02_functions/sort.cf
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ bundle agent init
bundle agent test
{
meta:
"test_soft_fail" string => "hpux|sunos_5_9|windows",
"test_soft_fail" string => "hpux|sunos_5_9",
meta => { "redmine4934", "redmine5107" };
"test_flakey_fail" string => "windows",
meta => { "ENT-10254" };


vars:
Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance/01_vars/02_functions/strftime.cf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ bundle edit_line init_insert

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10253" };

vars:
"vals" slist => {
strftime('gmtime', '%F %T', 100000000),
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/01_vars/02_functions/url_get_local.cf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ bundle agent test
{
meta:
"test_skip_unsupported" string => "!feature_curl";
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };

vars:
"kept" data => mergedata(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ bundle agent test
meta:
"description" -> { "CFE-4080" }
string => "Test validjson() with trailing bogus data";
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };
}

##############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ body common control

bundle agent init
{
commands:
windows::
"$(G.dos2unix) $(this.promise_filename).expected" -> { "ENT-10433" };

files:
"$(G.testdir)/actual.txt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ bundle agent init
vars:
"autorun" slist => bundlesmatching(".*", "autorun");

commands:
windows::
"$(G.dos2unix) $(this.promise_filename).expected" -> { "ENT-10433" };

files:
"$(G.testfile)"
edit_line => empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ bundle agent init
vars:
"autorun" slist => bundlesmatching(".*", "autorun");

commands:
windows::
"$(G.dos2unix) $(this.promise_filename).expected" -> { "ENT-10433" };

files:
"$(G.testfile)"
edit_line => empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ bundle agent init
meta:
"tags" slist => { "find" };

commands:
windows::
"$(G.dos2unix) $(this.promise_filename).expected" -> { "ENT-10433" };

vars:
# We want to be sure we can reference this data subsequently
"d" data => parsejson( '{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ bundle agent init
{
meta:
"tags" slist => { "find" };
commands:
windows::
"$(G.dos2unix) $(this.promise_filename).expected" -> { "ENT-10433" };

}

bundle agent test
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/01_vars/deep_delayed_expansion/main.cf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ bundle agent test
{
meta:
"description" string => "Test that variables containing other variales are de-referenced";
"test_soft_fail" string => "windows",
meta => { "ENT-10256" };
}

bundle agent check
Expand Down
Loading