-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define multiple structs to implement the tests. Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
1 parent
8f5a68a
commit 113b165
Showing
3 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Package testcase implements the common structs used for defining | ||
// testcases. | ||
package testcase | ||
|
||
// Config struct is used to pass arbitrary information into the tests | ||
// such as IP address, expected FRU content, expected sensors | ||
type Config struct { | ||
Host string | ||
Username string | ||
Password string | ||
|
||
// ... to be extended | ||
} | ||
|
||
// Result struct is used for returning test results from running a test | ||
type Result struct { | ||
// what was tested | ||
Name string | ||
|
||
// != nil in case something went wrong, | ||
// this should contain a descriptive string for the logs. | ||
// e.g. "while running command X, expected A but output was B' | ||
Error error | ||
|
||
// to store stdout/stderr from a command, if any | ||
Output string | ||
} | ||
|
||
// Test struct is used to define a test which can return one or more results | ||
type Test struct { | ||
// e.g. "IPMI Sensor" | ||
Name string | ||
|
||
// e.g. "Testing the 'ipmitool sensor' output | ||
Description string | ||
|
||
Function func(tc Config) []Result | ||
|
||
Results []Result | ||
} |