Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skeleton structs #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add skeleton structs #12

wants to merge 1 commit into from

Conversation

pointbazaar
Copy link
Collaborator

Define multiple structs to implement the tests.

pkg/test/test.go Outdated Show resolved Hide resolved
pkg/test/test.go Outdated Show resolved Hide resolved
pkg/test/test.go Outdated
type Result struct {

// what was tested
Name string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unnecessary redundancy since result should be part of the Test struct below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The name is required to have things like a tescase for temperature sensors, similar to how it's already done in the existing tool. Since we do not write a new struct and new function for every sensor, one test will test all the temp sensors and return multiple Result structs.

Each Result struct will then have the name of the sensor tested.
So when we print the results, we print the Name from struct Test and also the Name from struct Result.

Example:

PASS [Test] [redfish sensors] [sensor VR_TEMP_1] 
PASS [Test] [redfish sensors] [sensor VR_TEMP_2] 
PASS [Test] [redfish sensors] [sensor VR_TEMP_3] 
PASS [Test] [redfish sensors] [sensor SYS_AIR_INLET] 

or

FAIL [Test] [redfish sensors] [sensor VR_TEMP_1] Error: could not query redfish
PASS [Test] [redfish sensors] [sensor VR_TEMP_2] 

pkg/test/test.go Outdated Show resolved Hide resolved
@pointbazaar pointbazaar force-pushed the test-struct branch 2 times, most recently from 90f4a46 to 113b165 Compare September 18, 2024 09:44
Define multiple structs to implement the tests.

Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Golang related testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants