Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
Amend acceptance tests for testsuite to pass on Windows
Browse files Browse the repository at this point in the history
For now, majority of tests are marked as soft-fail (a failure is expected).

Follow-up tasks are created (and linked) to investigate these failures
one-by-one.

Changelog: none

Ticket: ENT-2664
  • Loading branch information
Aleksei Shpakovskii committed Jul 13, 2023
1 parent 9ee4a60 commit 895c3ca
Show file tree
Hide file tree
Showing 226 changed files with 765 additions and 65 deletions.
4 changes: 4 additions & 0 deletions tests/acceptance/00_basics/01_compiler/string_contexts.cf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ body common control

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

defaults:
"s1" string => "1";
"s2" string => "2";
Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance/00_basics/01_compiler/with_iteration.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-10254" };

vars:
"probe" string => "0";
"iter" slist => { "1", "2", "3" };
Expand Down
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));
}
9 changes: 9 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,15 @@ body common control

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

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

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

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
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/01_basic/this_variables.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ bundle agent init

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };
vars:
"var" slist => { "var in test" };
"var_test" slist => { "var_test in test" };
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/01_vars/02_functions/cf_version.cf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ body common control

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };
vars:
"after_newer" string => "yes",
if => cf_version_after("1.0.0");
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/01_vars/02_functions/data_expand.cf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ body common control

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };
vars:
"x" string => "foo";
"y" int => "200";
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/01_vars/02_functions/every_some_none.cf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ body common control

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };
methods:
"pretest";
"collect";
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
3 changes: 3 additions & 0 deletions tests/acceptance/01_vars/02_functions/filter.cf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ body common control

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };
vars:
"tests" slist => { "fgrep09", "exact1", "exactdot", "regexdot", "invert", "max2", "max0", "grep09" };
"lists" slist => { "s1", "d1", "d2", "dempty" };
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
3 changes: 3 additions & 0 deletions tests/acceptance/01_vars/02_functions/format_edge_case.cf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ body common control
##########################################################

bundle agent test {
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };
vars:
"str" string => format('%s', 'Hello, everyone! This is the LONGEST TEXT EVER! I was inspired by the various other longest texts ever on the internet, and I wanted to make my own. So here it is! This is going to be a WORLD RECORD! This is actually my third attempt at doing this. The first time, I didnt save it. The second time, the Neocities editor crashed. Now Im writing this in Notepad, then copying it into the Neocities editor instead of typing it directly in the Neocities editor to avoid crashing. It sucks that my past two attempts are gone now. Those actually got pretty long. Not the longest, but still pretty long. I hope this one wont get lost somehow. Anyways, lets talk about WAFFLES! I like waffles. Waffles are cool. Waffles is a funny word. Theres a Teen Titans Go episode called Waffles where the word Waffles is said a hundred-something times. Its pretty annoying. Theres also a Teen Titans Go episode about Pig Latin. Dont know what Pig Latin is? Its a language where you take all the consonants before the first vowel, move them to the end, and add -ay to the end. If the word begins with a vowel, you just add -way to the end. For example, Waffles becomes Afflesway. Ive been speaking Pig Latin fluently since the fourth grade, so it surprised me when I saw the episode for the first time. I speak Pig Latin with my sister sometimes. Its pretty fun. I like speaking it in public so that everyone around us gets confused. Thats never actually happened before, but if it ever does, twill be pretty funny. By the way, twill is a word I invented recently, and its a contraction of it will. I really hope it gains popularity in the near future, because twill is WAY more fun than saying itll. Itll is too boring. Nobody likes boring. This is nowhere near being the longest text ever, but eventually it will be! I might still be writing this a decade later, who knows? But right now, its not very long. But Ill just keep writing until it is the longest! Have you ever heard the song Dau Dau by Awesome Scampis? Its an amazing song. Look it up on YouTube! I play that song all the time around my sister! It drives her crazy, and I love it. Another way I like driving my sister crazy is by speaking my own made up language to her. She hates the languages I make! The only language that we both speak besides English is Pig Latin. I think you already knew that. Whatever. I think Im gonna go for now. Bye! Hi, Im back now. Im gonna contribute more to this soon-to-be giant wall of text. I just realised I have a giant stuffed frog on my bed. I forgot his name. Im pretty sure it was something stupid though. I think it was FROG in Morse Code or something. Morse Code is cool. I know a bit of it, but Im not very good at it. Im also not very good at French. I barely know anything in French, and my pronunciation probably sucks. But Im learning it, at least. Im also learning Esperanto. Its this language that was made up by some guy a long time ago to be the universal language. A lot of people speak it. I am such a language nerd. Half of this text is probably gonna be about languages. But hey, as long as its long! Ha, get it? As LONG as its LONG? Im so funny, right? No, Im not. I should probably get some sleep. Goodnight! Hello, Im back again. I basically have only two interests nowadays: languages and furries. What? Oh, sorry, I thought you knew I was a furry. Haha, oops. Anyway, yeah, Im a furry, but since Im a young furry, I cant really do as much as I would like to do in the fandom. When Im older, I would like to have a fursuit, go to furry conventions, all that stuff. But for now I can only dream of that. Sorry you had to deal with me talking about furries, but Im honestly very desperate for this to be the longest text ever. Last night I was watching nothing but fursuit unboxings. I think I need help. This one time, me and my mom were going to go to a furry Christmas party, but we didnt end up going because of the fact that there was alcohol on the premises, and that she didnt wanna have to be a mom dragging her son through a crowd of furries. Both of those reasons were understandable. Okay, hopefully I wont have to talk about furries anymore. I dont care if youre a furry reading this right now, I just dont wanna have to torture everyone else.');
"list" slist => { $(str) };
Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/01_vars/02_functions/getindices.cf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ bundle common b

bundle agent test
{
meta:
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };
vars:
"user[name]" string => "zamboni";
"user[fullname][first]" string => "Diego";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ bundle agent init
bundle agent test
{
meta:
"test_soft_fail" string => "!any",
meta => { "redmine7116" };
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };

vars:
"values_data_1" slist => getindices("init.data[bar]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ bundle agent init
bundle agent test
{
meta:
"test_soft_fail" string => "!any",
meta => { "redmine7116" };
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };

vars:
# expected: one, two
Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance/01_vars/02_functions/gettags.cf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ bundle common init

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

vars:
"tags1" slist => getclassmetatags("myclass");
"tags2" slist => getclassmetatags("myplainclass");
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
4 changes: 4 additions & 0 deletions tests/acceptance/01_vars/02_functions/getvalues.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-10254" };

vars:
"user[name]" string => "zamboni";
"user[fullname][first]" string => "Diego";
Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance/01_vars/02_functions/getvalues_containers.cf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ bundle agent init

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

vars:
"arr_v" slist => getvalues("init.arr");

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

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

vars:
"values_data" slist => getvalues("init.data");
"values_data2" slist => getvalues("init.data2");
Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance/01_vars/02_functions/ifelse.cf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ bundle common init

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

classes:
"myclass2" expression => "any";
vars:
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/01_vars/02_functions/ifelse_isvariable.cf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ bundle agent test
meta:
"description"
string => "Test that ifelse can use the result of isvariable as a class identifer";
"test_soft_fail" string => "windows",
meta => { "ENT-10254" };

vars:
# Since init.passwd_file is defined, I expect the value to be
Expand Down
Loading

0 comments on commit 895c3ca

Please sign in to comment.