-
Notifications
You must be signed in to change notification settings - Fork 8
parser that parsed test scenarios describe in a yaml format #81
Conversation
Runs [][]string | ||
} | ||
|
||
func parse(bts []byte) (scns []*Scenario, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be misleading that the parse-method only returns scenario's instead of a testYaml-struct (with config and scenario's)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right, this'll have to change later but since the config of the testYaml is not yet declared. (I think it's pretty much defined in Sever and my head though) I will leave like this. Until Sever's cluster-manager is done, which is when we can actually be sure what we want to do with the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for not indicating this earlier
Adding unit-tests for some of these more generic methods might make sense as well |
I think adding tests for this adds no value. For the other cases it added some insight but it's a lot of work to do every case. And if the parsing isn't correct you'll find that out immediately when you run the tests. |
var measureStrs []string | ||
for _, measureStr := range data.Measure { | ||
measureStrs = append(measureStrs, replace(measureStr, varsData, runData)) | ||
measureStrs := make([]string, len(data.Measure)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other option here is:
var mesuareStrs := make([]string, 0, len(data.Measure))
for _m measureStr := range.Measure {
measureStrs = append(measureStrs, replace(measureStr, varsData, runData))
}
for _, scenarioData := range runs.Scenarios { | ||
for _, vari := range scenarioData.Runs[0] { | ||
if vari[0] != '<' || vari[len(vari)-1] != '>' { | ||
panic(fmt.Sprintf("variable '%s' not of the from <var>", vari)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: from -> form
one typo but besides that: LGTM |
This PR contains placeholder structs for Command and Scenario which can be filled in by the parser which will be added to Part 5 of the cluster-test-orchestrater in #81 . This PR also contains a calculator utility that is also used while parsing the test yaml-files.
Part 5 of the cluster-test-orchestrator.
This file parses the tests from a yaml format to the Scenario struct. It uses the structures defined in #75 (Measurement and Assertion) and #76 (Scenario and Command).