Skip to content

CFE-3041: Made testall fail regular acceptance tests which log errors - #6405

Open
aleksandrychev wants to merge 16 commits into
cfengine:masterfrom
aleksandrychev:CFE-3041
Open

aleksandrychev wants to merge 16 commits into
cfengine:masterfrom
aleksandrychev:CFE-3041

Conversation

@aleksandrychev

@aleksandrychev aleksandrychev commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Tests that print Pass message but have logs errors will fail with FAIL (Error printed) message. Tests which are expected to log errors should use .error.cf or .error.pass.cf suffix. see: tests/acceptance/README

together:

Ticket: CFE-3041

@aleksandrychev

Copy link
Copy Markdown
Contributor Author

@cf-bottom jenkins please

@cf-bottom

Copy link
Copy Markdown

@olehermanse olehermanse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot be done on its own - there are hundreds of tests that need to be reviewed and adjusted after this change in testall.

@aleksandrychev

Copy link
Copy Markdown
Contributor Author

This cannot be done on its own - there are hundreds of tests that need to be reviewed and adjusted after this change in testall.

I see, there are quite a lot of them. So, we need to identify which ones are expected and should be renamed, and also find the ones that shouldn't be there. As a first step, I'll create a table listing each failure and the errors printed.

@aleksandrychev
aleksandrychev marked this pull request as draft October 14, 2026 18:43
@aleksandrychev

aleksandrychev commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

at least half of errors can be fixed easily with a fileexists guard.
for example 01_vars/02_functions/011.cf

error: Could not examine file '$WORKDIR/tmp/TEST.cfengine'
error: CfReadFile: Could not examine file '$WORKDIR/tmp/TEST.cfengine' (stat: No such file or directory)

the error comes from the test bundle:

vars:
    "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100);

vars are evaluated early (during policy validation and pre-evaluation), before init has created the file, so the read function fails and logs an error. A later pass reads the file fine, so the test still passes.

it can be fixed by adding a fileexists guard.

@aleksandrychev
aleksandrychev marked this pull request as ready for review October 15, 2026 13:56

@nickanderson nickanderson left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aleksandrychev The commit for Added fileexists() guards to file reads in acceptance tests is good. I think we could take it separately. Will continue looking into the other commits.

Looked through the rest and they all seem ok. Logged CFE-4752 which i found while reviewing.

"lefti" int => "$(init.pair[1])";
"rights" string => "$(init.pair[2])";
"rightr" real => "$(init.pair[2])";
"rightr" real => "$(init.pair[2])",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a bit odd. Maybe the question is why does only real vars log an error fail to parse real number when it encounters an empty string. Seems that we should align the int and real logging behavior here. I created CFE-4752 for that.

bundle common framework
{
classes:
"framework_loaded" expression => isvariable("G.testdir");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange. I guess this can affect all cases where a body is used (on classes or vars promises) in the entry file or in some bundle before reaching the body in pre-eval.

bundle common framework
{
classes:
"framework_loaded" expression => isvariable("G.testdir");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange. I guess this can affect all cases where a body is used (on classes or vars promises) in the entry file or in some bundle before reaching the body in pre-eval.

@aleksandrychev

Copy link
Copy Markdown
Contributor Author

@olehermanse your requested change blocks PR

@olehermanse

Copy link
Copy Markdown
Member

@cf-bottom jenkins please

@cf-bottom

Copy link
Copy Markdown

@olehermanse

Copy link
Copy Markdown
Member

@aleksandrychev please look at why Ubuntu failed.

@aleksandrychev
aleksandrychev marked this pull request as draft October 22, 2026 18:15
@aleksandrychev

aleksandrychev commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

@aleksandrychev please look at why Ubuntu failed.

I will look, maybe this is environment issue or platform-specific, as it passes in GH runner (ubuntu 24) and also passed in docker container (same as GH runner uses)

@nickanderson

Copy link
Copy Markdown
Member

@cf-bottom jenkins please

@cf-bottom

Copy link
Copy Markdown

@aleksandrychev

Copy link
Copy Markdown
Contributor Author

@nickanderson thanks for help here, now only diff_reporting_large_file.cf fails, looking at it

@aleksandrychev

Copy link
Copy Markdown
Contributor Author

@cf-bottom jenkins please

@cf-bottom

Copy link
Copy Markdown

@aleksandrychev

Copy link
Copy Markdown
Contributor Author

@cf-bottom jenkins please

@cf-bottom

Copy link
Copy Markdown

@aleksandrychev

Copy link
Copy Markdown
Contributor Author

Comment thread libpromises/evalfunction.c Fixed
@aleksandrychev

Copy link
Copy Markdown
Contributor Author

win acceptances - Build Status

@aleksandrychev
aleksandrychev marked this pull request as ready for review October 26, 2026 11:57
@aleksandrychev

Copy link
Copy Markdown
Contributor Author

@cf-bottom jenkins please

@cf-bottom

Copy link
Copy Markdown

@nickanderson

Copy link
Copy Markdown
Member

@cf-bottom jenkins, please

@cf-bottom

Copy link
Copy Markdown

@olehermanse

Copy link
Copy Markdown
Member

@cf-bottom jenkins, please

@cf-bottom

Copy link
Copy Markdown

aleksandrychev and others added 16 commits October 28, 2026 12:24
Tests that print Pass message but have logs errors will fail with `FAIL (Error printed)` message.
Tests which are expected to log errors should use `.error.cf` or `.error.pass.cf` suffix. see: `tests/acceptance/README`

Ticket: CFE-3041
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
These tests read files created by their own init bundle, but pre-evaluation calls the read functions before the files exist, logging "Could not examine file" errors which now fail regular tests.

Ticket: CFE-3041
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
Errors printed by the command were reported on lines starting with "error:", so testall mistook them for errors of the test itself.

Ticket: CFE-3041

Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
These tests read files and directories created by their own policy, but pre-evaluation calls the functions before they exist, logging errors which now fail regular tests.

Ticket: CFE-3041
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
The agent loads def.json from the directory of the input policy file, so tests in 00_basics/ tried to read this directory as their augments file and logged "Could not open JSON file" errors.

Ticket: CFE-3041
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
The test used the 'immediate' body from plucked.sub.cf before it was
loaded during pre-evaluation, so the promise is now skipped until the
test framework is loaded.

Ticket: CFE-3041
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
The test referred to a promise module which never existed and did not run its init and cleanup bundles.

Ticket: CFE-3041
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
The check bundle counted lines in files which do not exist until the test bundle has run, but the agent evaluates the functions of all promises before any bundle runs.

Ticket: CFE-3041
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
wrong-bundle-type.cf printed the sub-agent output in its DEBUG report, so the sub-agent errors were mistaken for errors of the test, and ifelse.cf used invalid class expressions as false conditions.

Ticket: CFE-3041
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
These tests intentionally exercise error paths, the reason is documented in the header of each test.

Ticket: CFE-3041
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
Ticket: CFE-3041
Signed-off-by: Nick Anderson <nick@cmdln.org>
Ticket: CFE-3041
Signed-off-by: Nick Anderson <nick@cmdln.org>
The errorpass branch only checked for logged errors and the Pass
message, so a test marked test_soft_fail or test_skip_unsupported was
reported as FAIL (e.g. process_select_fncalls.error.pass.cf on Windows,
which soft fails due to ENT-10217 and logs no errors there). Errorpass
tests now go through the regular outcome handling and only differ in
requiring at least one logged error on Pass.
Ticket: CFE-3041
Signed-off-by: Nick Anderson <nick@cmdln.org>
@aleksandrychev

Copy link
Copy Markdown
Contributor Author

@cf-bottom jenkins please

@cf-bottom

Copy link
Copy Markdown

@aleksandrychev

Copy link
Copy Markdown
Contributor Author

@cf-bottom jenkins please

@cf-bottom

Copy link
Copy Markdown

Sure, I triggered a build:

Build Status

Jenkins: https://ci.cfengine.com/job/pr-pipeline/14925/

Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-14925/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants