Skip to content

Commit

Permalink
Fixed two acceptance tests which could only run once before failing
Browse files Browse the repository at this point in the history
Their first run they change an original/source file and so on subsequent runs
the tests failed due to the original being incorrect.

Ticket: ENT-10761
Changelog: none
  • Loading branch information
craigcomstock committed Oct 9, 2023
1 parent 81e51d8 commit c8af66e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
15 changes: 12 additions & 3 deletions tests/acceptance/31_tickets/ENT-8788/1/main.cf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ bundle agent __main__
"bundlesequence" usebundle => default("$(this.promise_filename)");
}

bundle agent init
{
vars:
"original_file" string => "$(this.promise_dirname)/start.xml.txt";
"test_file" string => "$(sys.workdir)/start.xml.test";
files:
"$(test_file)"
copy_from => local_cp("${original_file}");
}

bundle agent test
{
meta:
Expand All @@ -19,11 +29,10 @@ bundle agent test
meta => { "ENT-8788" };

vars:
"test_file" string => "$(this.promise_dirname)/start.xml.txt";
"new_content_file" string => "$(this.promise_dirname)/newcontent.xml.txt";

files:
"$(test_file)"
"$(init.test_file)"
create => "false",
edit_defaults => size("500k"),
edit_line => insert_file_as_block_relative_to_first_or_last_line(
Expand All @@ -38,7 +47,7 @@ bundle agent check
{
methods:

"Pass/Fail" usebundle => dcs_check_diff($(test.test_file),
"Pass/Fail" usebundle => dcs_check_diff($(init.test_file),
"$(this.promise_dirname)/desired-result.xml.txt",
$(this.promise_filename));
}
Expand Down
15 changes: 12 additions & 3 deletions tests/acceptance/31_tickets/ENT-8788/2/main.cf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ bundle agent __main__
"bundlesequence" usebundle => default("$(this.promise_filename)");
}

bundle agent init
{
vars:
"original_file" string => "$(this.promise_dirname)/start.xml.txt";
"test_file" string => "$(sys.workdir)/start.xml.test";
files:
"$(test_file)"
copy_from => local_cp("${original_file}");
}

bundle agent test
{
meta:
Expand All @@ -19,11 +29,10 @@ bundle agent test
meta => { "ENT-8788" };

vars:
"test_file" string => "$(this.promise_dirname)/start.xml.txt";
"new_content_file" string => "$(this.promise_dirname)/newcontent.xml.txt";

files:
"$(test_file)"
"$(init.test_file)"
create => "false",
edit_defaults => size("500k"),
edit_line => insert_file_as_block_relative_to_first_or_last_line(
Expand All @@ -38,7 +47,7 @@ bundle agent check
{
methods:

"Pass/Fail" usebundle => dcs_check_diff($(test.test_file),
"Pass/Fail" usebundle => dcs_check_diff($(init.test_file),
"$(this.promise_dirname)/desired-result.xml.txt",
$(this.promise_filename));
}
Expand Down

0 comments on commit c8af66e

Please sign in to comment.