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

Add unit tests for storage module #446

Merged
merged 1 commit into from Oct 21, 2015
Merged

Conversation

JeanFred
Copy link
Member

As I was trying to track down either a bug in Carbon parsing or a mistake in my storage-aggregation.conf file (for the story, it turned out my carbon deamon just had to be restarted :-°), I ended up writing this test suite for the storage module.

The all NoConfigSchemaLoadingTest class, whose purpose is to test what happens when CONF_DIR leads nowhere, is commented out though. For some reason, the mock of carbon.conf.settings persists between classes. (if I test NoConfigSchemaLoadingTest by itself it works fine). I have fiddled around with trying to reload(carbon.conf) in setUp or tearDown but to no avail. Maybe someone will have a better idea? Otherwise I suppose it’s fine removing this test class alltogether.

Hope that helps!

@JeanFred
Copy link
Member Author

JeanFred commented Oct 1, 2015

Thoughts? :)

# from carbon.storage import loadStorageSchemas
# from carbon.exceptions import CarbonConfigException
# with self.assertRaises(CarbonConfigException):
# loadStorageSchemas()
Copy link
Member

Choose a reason for hiding this comment

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

Please don't add large swaths of code that is commented out. Uncomment it or remove it.

Copy link
Member Author

Choose a reason for hiding this comment

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

As I explained in the PR, I was hoping someone might be able to enlighten me regarding this mock persistence across tests. If not, sure I’ll remove it.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha. I can look at it more tomorrow or this weekend

@SEJeff
Copy link
Member

SEJeff commented Oct 1, 2015

More tests are always great, although I'm not the biggest fan of having to do the imports in every test. DRY

Please remove or fix the commented code and we will happen my merge this however. Thanks for doing this!

@JeanFred
Copy link
Member Author

More tests are always great, although I'm not the biggest fan of having to do the imports in every test. DRY

I think I had to do this because of the mock persistence, although I am not entirely sure anymore.

SEJeff added a commit that referenced this pull request Oct 21, 2015
Add unit tests for storage module
@SEJeff SEJeff merged commit e1ec8e3 into graphite-project:master Oct 21, 2015
@SEJeff
Copy link
Member

SEJeff commented Oct 21, 2015

@JeanFred Thanks that makes sense. Merged! Feel free to write more if you feel so inclined. Sorry this took so long to get merged

@JeanFred
Copy link
Member Author

Thanks for merging @SEJeff! What about the commented out code − shall we just leave it there until someone figures it out ? Or let’s remove it as it will probably rot otherwise ?

@SEJeff
Copy link
Member

SEJeff commented Oct 21, 2015

@JeanFred if I find the time I'll take a look at it, but carbon is a piece of the graphite project that I tend to not deal with much as I don't actually use it. @mleinart is really good wrt carbon

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.

None yet

2 participants