DEV Community


Posted on

Planning for release 2.8

This week, we talked to each other on what we were gonna work on for release 2.8.

My plan is to finish the parser service, I'm struggling a bit with e2e tests but (Roxanne)[] offered me some help with changing the mocked indexer to Elasticsearch mock, it became easier.

Writing e2e tests for parser:

Most unit tests are written already, I just ported those tests over to sr/api/parser, changed some imports and added a few small tests.

My approach is to clear the redis database first and add a few feeds (invalid, valid, youtube) to the queue to process using a custom mocked getWikiFeeds() and fetch posts service to compare the result when the queue is drained.

My mistake when trying to write e2e tests was that I tried to use mocked Redis, but e2e is where you test the flow of the application so mocking is not needed. I've got the first test to work but encountered this problem

Jest did not exit one second after the test run has completed.

This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
Enter fullscreen mode Exit fullscreen mode

I then ran the test with --detectOpenHandles and found out that the code had a few Redis connections open, somehow logger is an open handle, such as

// src/api/parser/src/lib/queue.js
const client = Redis();
const subscriber = Redis();

// /src/api/parser/src/utils/storage.js
const { logger, Redis } = require('@senecacdot/satellite');
const redis = Redis();
Enter fullscreen mode Exit fullscreen mode

I have something in mind, will update this blog when I find a solution!

Personal notes: I hope the people of Ukraine can stay safe, I have a few Ukrainian friends and I can't imagine being in their shoes, it hurts me when thinking about it. The world has become unpredictable in the last 2 year.

Top comments (0)