git-proxy icon indicating copy to clipboard operation
git-proxy copied to clipboard

e2e testing of git-proxy

Open coopernetes opened this issue 1 year ago • 5 comments

We have a collection tests that validate git-proxy internals but nothing which runs in CI that validates changes acting as a client integrating with the git-proxy server(s). Tests should be run (at least on main or pre-release) to validate the server's behaviour end-to-end using a tool like serverspec or goss.

Another option would be a simple Docker-based test (package the app, run a container, run an HTTP-based test through it and shut down the container). container-structure-test is an option there. The below is an illustrative example - it's not a working test but should give an implementer a starting point.

schemaVersion: '2.0.0'
commandTests:
- name: 'verify git-proxy returns 200'
  setup:
    - ["npm", "install", "axios"]
    - ["npx", "--", "@finos/git-proxy"]
  command: 'node'
  args:
    - -e
    - |
      const axios = require("axios");
      axios.get("http://localhost:8080/api/v1/health")
        .then(function (response) {
          console.log(response.status);
        });
  expectedOutput: ["200"]
  exitCode: 0

Yup but I don't mean in a spec runner like jest or mocha where you have to manipulate the require cache.

It may be possible to setup jobs that simulate how the end user would test it in CI and just provide the env vars there to confirm by pinging the running services.

Originally posted by @lwhiteley in https://github.com/finos/git-proxy/issues/379#issuecomment-1879082571

coopernetes avatar Jan 11 '24 18:01 coopernetes

Hi, does this issue need to be looked at?

marksmith388 avatar Mar 29 '24 14:03 marksmith388

@marksmith388 - for sure! Wanna tackle it? 😇

JamieSlome avatar Mar 29 '24 14:03 JamieSlome

Absolutely!

marksmith388 avatar Mar 31 '24 21:03 marksmith388

I have a working solution using goss, what are my next steps?

marksmith388 avatar Mar 31 '24 23:03 marksmith388

@marksmith388 - thanks for joining the community call today and apologies for missing your message from last week 🤗

@coopernetes - can we define a number of test requirements for this ticket to make sure @marksmith388 has something clear to work towards?

Of course appreciate you said you would both follow up on Slack but posting here to serve more as a small reminder in any case 💡

JamieSlome avatar Apr 08 '24 16:04 JamieSlome