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

Make sure file logging works #3601

Merged
merged 1 commit into from
Jan 14, 2020
Merged

Conversation

karampok
Copy link
Contributor

@karampok karampok commented Jan 10, 2020

Our code base tries to create the log dir if does not exists.
It returns an error if the above is not possible.

Removes also some convey.

Fixes #2340


This change is Reviewable

@karampok karampok requested a review from scrye January 10, 2020 10:19
Copy link
Contributor

@scrye scrye left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @karampok)


go/lib/log/log_test.go, line 34 at r1 (raw file):

	}()

	testcases := map[string]struct {

CamelCase would be testCases here.


go/lib/log/log_test.go, line 44 at r1 (raw file):

		"can create, nil": {
			dir:       "/tmp/aka/should/exist",

It's cleaner to namespace test filesystem side effects under a temporary directory. See https://golang.org/pkg/io/ioutil/#TempDir.

So steps would be:

  • create temp dir at start of test
  • use any path underneath it instead of dir for the test case
  • remove the temp dir entirely in the defer at the end of the test

Copy link
Contributor Author

@karampok karampok left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @scrye)


go/lib/log/log_test.go, line 34 at r1 (raw file):

Previously, scrye (Sergiu Costea) wrote…

CamelCase would be testCases here.

Done.


go/lib/log/log_test.go, line 44 at r1 (raw file):

Previously, scrye (Sergiu Costea) wrote…

It's cleaner to namespace test filesystem side effects under a temporary directory. See https://golang.org/pkg/io/ioutil/#TempDir.

So steps would be:

  • create temp dir at start of test
  • use any path underneath it instead of dir for the test case
  • remove the temp dir entirely in the defer at the end of the test

Done.

Copy link
Contributor

@scrye scrye left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Our code base tries to create the log dir if does not exists.
It returns an error if the above is not possible.

Fixes scionproto#2340
Copy link
Contributor

@scrye scrye left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@karampok karampok merged commit e7c30dd into scionproto:master Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Go: logging lib doesn't notice if log dir doesn't exist
2 participants