Returning to Filer

Edit 2/27/29: I created a pull request, and have written more about my experiences in the section "Making The Test".

Another week, another bug to find and another pull request to make.

...Well, in theory, anyway.

Truth be told, I haven't made as much progress on this week's bug as I would have liked. One of my other courses had a major project due this same week, and that may have taken precedence over this project. Due to that, I don't have a pull request up yet, though I'll be sure to change that early on in the coming week. It is imperative that I stay on top of my work, after all; falling behind on one project leads to falling behind on the rest of them, like some awful game of academic dominoes.

Anyway, I'm getting off-topic here. Before I go off on another tangent, let's get into what we're actually here for--fixing bugs.

The Bug

For this week, I decided to return to a project I'd worked on before, called filer. I'd spent some time sniffing around other projects (Bootstrap, Angular, Angular CLI, etc...) for issues labelled "first good bug" or something similar, but nothing seemed to be suited to my skill set. Then someone in my class asked if we could do some more work on filer, and when it was confirmed that we could, I made a beeline for the project's repository. Much to my delight, there were a number of bugs labelled "good first bug".

Initially, I wanted to work on this issue here, but a classmate of mine beat me to it. I took another gander at the list of bugs and decided to deal with this one instead. For anyone who doesn't want to click through to read the issue itself, the gist of it is that an extra test needs to be added for a specific function. The goal is for the function, fs.readlink(), to return an error when the path it's given isn't a symbolic link. The goal of the test is to give said function such a path, and have it return an error.

It's an issue I (think I) can handle, though unlike before, I didn't quite go diving into the bug headfirst. It's been a while since I've dealt with anything file-system related (no, my previous work on filer definitely does not count) and I wanted to brush up on my knowledge a bit--just with respect to symbolic links. From there, I wanted to take a closer look at the test I was supposed to be nearly-replicating. You can take a look at it in the issue, along with the steps to follow for modifying the test to make it suitable for the intended purposes.

With all that done, I feel ready to tackle the hard part, which is fixing the issue itself. Once I've got a pull request up, I'll be sure to come back and update this post.

Making the Test

Fixing this issue wasn't overly difficult -- even for someone who hasn't written a test for code in 1.5 years. This was largely because the test itself was pretty much already written -- all I had to do was copy an existing test and make some changes to it. Said changes involved invoking another method first, though -- one I wasn't familiar with. The method in question, fs.mkdir(), was used a few times in the other tests in the same file, so I took a look at those to figure out what I needed to do. The answer was pretty simple: invoke fs.mkdir(), and then in the callback, put the code for the fs.readlink() test.

So that's exactly what I did, and I ended up with a working test pretty quickly. There's not a lot to talk about here, to be honest; I wrote the test, got it working, and made the pull request. I didn't run into any issues -- just some silly mistakes, like forgetting to type a semi-colon at the end of a line. The most important thing I took away from this experience was actually not related to encountering problems, but a note my professor left on my PR. While my changes were accepted and merged, he alerted me to the concept (and issues) of "spurious whitespace", which I've never heard of until now. Certainly something to keep in mind and look out for in future contributions.

Comments