Skip to content
This repository has been archived by the owner on Sep 25, 2020. It is now read-only.

parser that parsed test scenarios describe in a yaml format #81

Merged
merged 7 commits into from
Jun 20, 2016

Conversation

CorgiMan
Copy link
Contributor

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).

Runs [][]string
}

func parse(bts []byte) (scns []*Scenario, err error) {
Copy link
Contributor

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)

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@mennopruijssers
Copy link
Contributor

Adding unit-tests for some of these more generic methods might make sense as well

@CorgiMan
Copy link
Contributor Author

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))
Copy link
Contributor

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))
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: from -> form

@mennopruijssers
Copy link
Contributor

one typo but besides that: LGTM

@CorgiMan CorgiMan merged commit d93cf0b into ws-structs-for-parsing Jun 20, 2016
CorgiMan added a commit that referenced this pull request Jun 20, 2016
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.
@CorgiMan CorgiMan deleted the ws-scenario-parser branch June 20, 2016 15:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants