Closed KeesCBakker closed 3 months ago
No I see npm test
is a bit slower as it should be, as it first tries to sync all the packages. This is due to the bootstrap
script. Think that one is needed for our GitHub workflows. Let's see if we can decouple them.
Another problem I see is that halve of the time the tests are failing on my local machine:
When I run them again, everything works fine.
Looking into why. There might be some test interactions...
Made the testing faster in the dev container by using a volume (https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-targeted-named-volume).
Test should respond with a png graph in the default s3 region
fails half of the time (at my machine) because it sometimes returns panel 3 and sometimes 8. As we do not really care about the panel ID here (we're testing S3), I deduce the panel from the response.
it('should respond with a png graph in the default s3 region', async () => {
let response = await ctx.sendAndWaitForResponse('@hubot graf db AAy9r_bmk:cpu server=ww3.example.com now-6h');
response = response.replace(/\/[a-f0-9]{40}\.png/i, '/abdcdef0123456789.png');
let panelRegex = /panelId=(\d+)/
expect(response).to.match(panelRegex);
let panelId = response.match(panelRegex)[1]
expect(response).to.eql(
'CPU: https://graf.s3.us-standard.amazonaws.com/grafana/abdcdef0123456789.png - https://play.grafana.org/d/AAy9r_bmk/?panelId=' + panelId + '&fullscreen&from=now-6h&to=now&var-server=ww3.example.com'
);
});
Now it always works.
@stephenyeargin think this branch is ready to ship. Please check if you want to drop support for node 16
and you like the way we've refactored the testing and bootstrapping.
Some small refactoring:
parseInt
of the width and the height that come in as env variables.should respond with a png graph in the default s3 region
failing half of the time on my machine by making thepanelId
variable.--forbid-only --forbid-pending
to the GitHub workflow.