Skip to content

Commit

Permalink
Merge pull request #32 from mchf/master
Browse files Browse the repository at this point in the history
Why this?
Recall that this test suite works by mocking and watching the SCR layer.
Even if we don't mock anything, errors are recorded, like if a sysconfig file (console here) is missing.
The tested code imports several modules, and some of them have *constructors*.
That's where we read sysconfig/console even if we don't care.

A better way to fix this is to remove the constructors and replace the public variables they initialize by a lazy functional API. In this case it means touching yast2.rpm (Encoding.ycp) and yast2-country.rpm (using Encoding::console).
  • Loading branch information
mvidner committed Nov 12, 2012
2 parents 6006245 + 5f0f4f7 commit 42028be
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
6 changes: 6 additions & 0 deletions package/yast2-network.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Nov 6 10:44:59 UTC 2012 - mfilka@suse.com

- Fixed testsuite. tests/include.ycp, tests/udev.ycp failed when
missing /etc/sysconfig/console.

-------------------------------------------------------------------
Thu Oct 25 21:04:58 UTC 2012 - mfilka@suse.com

Expand Down
5 changes: 5 additions & 0 deletions testsuite/tests/include.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Read .target.tmpdir nil
Log Failed to set temporary directory: nil
Read .probe.architecture "i386"
Read .sysconfig.console.CONSOLE_ENCODING nil
Execute .target.bash_output "locale -k charmap" $["exit":0, "stderr":"", "stdout":""]
24 changes: 23 additions & 1 deletion testsuite/tests/include.ycp
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
// A basic syntax check
{
include "network/lan/hardware.ycp";
// wonderful, isn't it? Believe me, you can't live without that.
// At least if you need Encoding.ycp which is included from somewhere.
import "Testsuite";

map READ = $[
"probe" : $[
"architecture" : "i386",
],
];

map EXEC = $[
"target": $[
"bash_output": $[
"stdout": "",
"stderr": "",
"exit": 0
],
],
];

Testsuite::Init( [ READ, $[], EXEC ], nil);

include "network/lan/hardware.ycp";
}
5 changes: 5 additions & 0 deletions testsuite/tests/udev.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Read .target.tmpdir nil
Log Failed to set temporary directory: nil
Read .probe.architecture "i386"
Read .sysconfig.console.CONSOLE_ENCODING nil
Execute .target.bash_output "locale -k charmap" $["exit":0, "stderr":"", "stdout":""]
20 changes: 20 additions & 0 deletions testsuite/tests/udev.ycp
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
{
import "Assert";
import "Testsuite";

map READ = $[
"probe" : $[
"architecture" : "i386",
],
];

map EXEC = $[
"target": $[
"bash_output": $[
"stdout": "",
"stderr": "",
"exit": 0
],
],
];

Testsuite::Init( [ READ, $[], EXEC ], nil);

import "LanItems";

include "network/routines.ycp";
Expand Down

0 comments on commit 42028be

Please sign in to comment.