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

Issue #98 core acceptance tests #101

Merged
merged 25 commits into from
Jan 29, 2017
Merged

Conversation

reaandrew
Copy link
Member

@reaandrew reaandrew commented Jan 22, 2017

Closes #98
Closes #102
Closes #99

@reaandrew reaandrew added this to the v1.0.0 milestone Jan 22, 2017
@reaandrew reaandrew requested a review from jamlen January 22, 2017 18:41
@reaandrew reaandrew changed the title Issue #95 core acceptance tests Issue #98 core acceptance tests Jan 22, 2017
@coveralls
Copy link

coveralls commented Jan 22, 2017

Coverage Status

Coverage increased (+1.0%) to 52.662% when pulling 8eec5fd on issue_#95_core_acceptance_tests into d68d3a6 on develop.


Expect(err).To(BeNil())

var runningTimeToParse = strings.Replace(summary.RunningTime, "s", "", -1)
Copy link
Member

Choose a reason for hiding this comment

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

Seeing the repetition here, I think it might be worth introducing either a function, or better yet a custom matcher (http://onsi.github.io/gomega/#adding-your-own-matchers) so you could just do something like:

Ω.(summary.RunningTime).Should(EqualDurationFromString(5))

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed


Expect(string(output)).To(ContainSubstring("Summary"))
Expect(summary.Error).To(ContainSubstring("Request body file not found: missing-file.json"))
})

It("Error non-http url in the urls file causes a run time exception #21", func() {
Copy link
Member

Choose a reason for hiding this comment

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

I'm guessing that since the move to GH issue 21 is not the same as it was on GitLab, might be worth just removing the #21 as I think the test name describes the behaviour sufficiently.

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

@@ -40,6 +40,8 @@ const (
LogMessageVaidURLs = "Your urls in the test specification must be absolute and valid urls"
)

var ()
Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

@@ -69,6 +71,8 @@ func HandlePanic() {
}

if err := recover(); err != nil { //catch
fmt.Println("ERROR")
fmt.Println()
Copy link
Member

Choose a reason for hiding this comment

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

Were these meant to be left in?

Copy link
Member Author

Choose a reason for hiding this comment

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

NO - this was going to be something - good catch.

}

func parseRunningTime(data string) string {
var runningTime = regexp.MustCompile(`Running Time: ([\d\w\.]+)`)
Copy link
Member

Choose a reason for hiding this comment

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

You could refactor this slightly to move the regexp MustCompile and FindStringSubmatch to inside the checkMatchXXX methods resulting in:

return checkMatchString(`Running Time: ([\d\w\.]+)`, data)

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice - agreed.

}

func checkMatchString(match []string) string {
if len(match) != 2 {
Copy link
Member

Choose a reason for hiding this comment

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

Why should len(match) be 2? seems a little 'magic number' to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

The result of the match is:

1[0]. The full string
2[1]. The 1st matching group
n[n-1] The nth matching group

I agree it is a matching number. I will assign it to a variable.

Copy link
Member Author

Choose a reason for hiding this comment

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

These are deleted now as I am using your JSON output

}
}

func checkMatchString(match []string) string {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't all the fields on the Summary be numeric of some kind... why do a string match?

Copy link
Member Author

Choose a reason for hiding this comment

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

i KNEW you would catch this one lol ;-) OK - totally agree. I deferred it - lazy me.

Copy link
Member Author

Choose a reason for hiding this comment

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

Deleted now

@coveralls
Copy link

Coverage Status

Coverage increased (+1.0%) to 52.662% when pulling ca24d2f on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.0%) to 52.662% when pulling 478db72 on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-51.7%) to 0.0% when pulling e047ac0 on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-51.7%) to 0.0% when pulling 395627b on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

coveralls commented Jan 23, 2017

Coverage Status

Coverage decreased (-51.7%) to 0.0% when pulling a7d32e7 on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-51.7%) to 0.0% when pulling 216cf04 on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.06%) to 53.766% when pulling 9f0515b on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.0%) to 53.709% when pulling 5a9552a on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

coveralls commented Jan 25, 2017

Coverage Status

Coverage increased (+16.1%) to 67.829% when pulling 124b6e3 on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage increased (+3.04%) to 54.752% when pulling b5753c2 on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage increased (+3.0%) to 54.702% when pulling beed8a0 on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-51.7%) to 0.0% when pulling 9fc6660 on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-51.7%) to 0.0% when pulling a547d93 on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.0%) to 53.665% when pulling b3a1b24 on issue_#95_core_acceptance_tests into d68d3a6 on develop.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.06%) to 54.359% when pulling a4f3bbe on issue_#95_core_acceptance_tests into e71d64b on develop.

@reaandrew
Copy link
Member Author

@jamlen All requested changes done and #103 has been integrated. Ready for review and merge if happy.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.06%) to 54.359% when pulling 93a45b3 on issue_#95_core_acceptance_tests into e71d64b on develop.

@reaandrew
Copy link
Member Author

How do you mark the review comments as done?

Copy link
Member

@jamlen jamlen left a comment

Choose a reason for hiding this comment

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

Just a few comments, minor really so its up to you!

@@ -27,10 +25,11 @@ func merge(source map[string]interface{}, extra map[string]interface{}) map[stri
//PlanExecutionContext encapsulates the runtime state in order to execute
//a plan
type PlanExecutionContext struct {
//Publisher telegraph.LinkedPublisher
Copy link
Member

Choose a reason for hiding this comment

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

Lets clean up the commented out code here...

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed

@@ -97,7 +96,12 @@ func (instance *PlanExecutionContext) workerExecuteJob(ctx context.Context, job
for _, action := range step.After {
_ = action.Execute(ctx, nil)
}
instance.Publisher.Publish(executionResult)

//inproc.Lock.Lock()
Copy link
Member

Choose a reason for hiding this comment

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

Are these lines left commented out for a reason?

Copy link
Member Author

Choose a reason for hiding this comment

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

nah - deleted them.

@@ -189,10 +193,11 @@ type ExecutionBranch interface {

//PlanExecutor ...
type PlanExecutor struct {
//Publisher telegraph.LinkedPublisher
Copy link
Member

Choose a reason for hiding this comment

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

Clean up comments

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed

Publisher: telegraph.NewLinkedPublisher(),
Config: config,
Bar: bar,
//Publisher: telegraph.NewLinkedPublisher(),
Copy link
Member

Choose a reason for hiding this comment

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

More commented out code

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed


go func() {
for range channel {
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this correct that we are ranging over the channel and doing nothing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeh - only so that I can write to the channel and not have to know how many messages I am going to send. I could avoid this loop and instead create a buffered channel i.e.

var channel = make(channel, numberOfMessages)

To avoid having to think of what value numberOfMessages is going to be I simply did that iteration so that the channels would drain but I am not interested in the message that is on the channel.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thing is though if I get the value of numberOfMessages wrong, the write operation to the channel will block. With this way it won't.


var _ = Describe("GreaterThanAssertionParser", func() {

It("Parses", func() {
Copy link
Member

Choose a reason for hiding this comment

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

What about some It("fails to parse") tests

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed will add

)

var _ = Describe("GreaterThanOrEqualAssertionParser", func() {
It("Parses", func() {
Copy link
Member

Choose a reason for hiding this comment

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

What about some It("fails to parse") tests

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed will add

)

var _ = Describe("LessThanAssertionParser", func() {
It("Parses", func() {
Copy link
Member

Choose a reason for hiding this comment

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

What about some It("fails to parse") tests

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed will add

)

var _ = Describe("LessThanOrEqualAssertionParser", func() {
It("Parses", func() {
Copy link
Member

Choose a reason for hiding this comment

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

What about some It("fails to parse") tests

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed will add

)

var _ = Describe("NotEmptyAssertionParser", func() {
It("Parses", func() {
Copy link
Member

Choose a reason for hiding this comment

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

What about some It("fails to parse") tests

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed will add

@coveralls
Copy link

Coverage Status

Coverage increased (+1.2%) to 54.477% when pulling 26b475f on issue_#95_core_acceptance_tests into e71d64b on develop.

@jamlen jamlen merged commit 8477899 into develop Jan 29, 2017
@jamlen jamlen deleted the issue_#95_core_acceptance_tests branch January 29, 2017 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants