Everybody Struggles

During first month of Outreachy internship I was working on adding file shares resize feature in Manila UI. Manila is the OpenStack Shared File Systems service that provides file storage to a virtual machine. It can be managed through command line or user-friendly dashboard. I’m working on a dashboard, adding feature to be able to shrink shares, as it now supports only extending file shares.

I had and idea on how to implement it and everything was working as expected. Then it was time to write tests. I made some changes to the code and test data. When I run tests, it kept failing. It was giving same type error on all tests. I didn’t give up and read unittest documentation. Then I removed all my changes and wrote the tests again. But it was the same. I googled for the error I was having and couldn’t find any solution. So I left it and was going to contact my mentor next day. Copied my logs from the terminal and made it ready.

Then while going to sleep later at night, I realized where it was wrong. Was silly actually. There was new size field in the form, which before was accepting zero. And I thought, zero size file share doesn’t make sense and limited it to minimal value of one. I left zero in the test case unchanged, and of course, function with zero as argument failed, and returned None. Here was my TypeError with Integer value and None.

Solution was simple, to remove zero from the test case. And voila, my tests were working 🙂

If I’m stuck, first thing I do is reading my code again. Maybe there is typo or like. Next, check documentation and search on StackOverflow or Google. And third, contact mentor. I like searching for solutions by myself first, because I learn how to solve it and understand why it happened. I don’t know it is right or wrong, it is the approach I’m used to.

What do you do when you are stuck?

Image by PublicDomainPictures from Pixabay 

Leave a Reply

Your email address will not be published. Required fields are marked *