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

[TEST] increase test coverage of package runtime to maximum #75

Merged
merged 1 commit into from
Oct 12, 2017

Conversation

genofire
Copy link
Member

@genofire genofire commented Oct 5, 2017

No description provided.

@genofire genofire added the wip label Oct 5, 2017
@genofire genofire self-assigned this Oct 5, 2017
@genofire genofire requested a review from corny October 5, 2017 13:26
@FreifunkBremen FreifunkBremen deleted a comment from coveralls Oct 5, 2017
@FreifunkBremen FreifunkBremen deleted a comment from coveralls Oct 5, 2017
@FreifunkBremen FreifunkBremen deleted a comment from coveralls Oct 5, 2017
@genofire genofire changed the title [TEST] runtime config to 100% [TEST] increase test coverage of package runtime to 100% Oct 5, 2017
@FreifunkBremen FreifunkBremen deleted a comment from coveralls Oct 5, 2017
srv := New(":8080", "/tmp")
assert.NotNil(srv)

//TODO test panic in a go routine (HOWTO)
Copy link
Member

Choose a reason for hiding this comment

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

Please also stop the server.

Copy link
Member Author

Choose a reason for hiding this comment

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

Closing the webserver create a panic 👎 -> so this tests fails

Copy link
Member

Choose a reason for hiding this comment

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

Then fix it!

Copy link
Member

Choose a reason for hiding this comment

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

@@ -38,7 +38,8 @@ var serveCmd = &cobra.Command{
if config.Webserver.Enable {
log.Println("starting webserver on", config.Webserver.Bind)
srv := webserver.New(config.Webserver.Bind, config.Webserver.Webroot)
go srv.Close()
go webserver.Start(srv)
defer srv.Close()
Copy link
Member Author

Choose a reason for hiding this comment

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

Sag mal, war das ein Bug mit defer vs. go ? @corny

Copy link
Member

Choose a reason for hiding this comment

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

go srv.Close() sieht falsch aus.

@FreifunkBremen FreifunkBremen deleted a comment from coveralls Oct 5, 2017
@FreifunkBremen FreifunkBremen deleted a comment from coveralls Oct 7, 2017
@genofire genofire added review and removed wip labels Oct 7, 2017
@genofire
Copy link
Member Author

genofire commented Oct 7, 2017

@corny magstdu es dir durchschauen und ggf. squash mergen?

@genofire genofire changed the title [TEST] increase test coverage of package runtime to 100% [TEST] increase test coverage of package runtime to maximum Oct 7, 2017
assert := assert.New(t)

srv := New(":8080", "/tmp")
assert.NotNil(srv)
Copy link
Member

Choose a reason for hiding this comment

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

Bitte den Server Socket wieder schließen im Test!

Copy link
Member Author

Choose a reason for hiding this comment

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

ups, stimmt, da war noch was

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

Das ist scheiße. Wenn der Server ordentlich beendet wird, darf es kein panic geben!

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah cool, die haben die Errors als const definiert 👍
Done

@FreifunkBremen FreifunkBremen deleted a comment from coveralls Oct 7, 2017
assert := assert.New(t)

srv := New(":8080", "/tmp")
assert.NotNil(srv)
Copy link
Member

Choose a reason for hiding this comment

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

Das ist scheiße. Wenn der Server ordentlich beendet wird, darf es kein panic geben!

@FreifunkBremen FreifunkBremen deleted a comment from coveralls Oct 11, 2017
func Start(srv *http.Server) {
// service connections
if err := srv.ListenAndServe(); err != nil {
if err != http.ErrServerClosed {
panic(err)
Copy link
Member

Choose a reason for hiding this comment

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

ListenAndServe() gibt niemals nil zurück. Bitte vereinfachen.

@coveralls
Copy link

coveralls commented Oct 11, 2017

Coverage Status

Coverage increased (+1.5%) to 57.117% when pulling 5ed98f3 on increase-testing into 3649bdd on master.

@FreifunkBremen FreifunkBremen deleted a comment from coveralls Oct 11, 2017
@FreifunkBremen FreifunkBremen deleted a comment from coveralls Oct 11, 2017
@FreifunkBremen FreifunkBremen deleted a comment from coveralls Oct 12, 2017
@genofire
Copy link
Member Author

Soll ich schon mal squashen? Oder magst zum verfolgen noch die einzelnen commit haben

@corny corny merged commit b892105 into master Oct 12, 2017
@corny corny deleted the increase-testing branch October 12, 2017 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants