parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Create dummy DB adapter repo that runs Parse Sever tests

Open mtrezza opened this issue 1 year ago • 5 comments

New Feature / Enhancement Checklist

Feature / Enhancement Description

This purpose of this issue is to centralize the discussion around how to create a dummy DB adapter repo as a POC to demonstrate the test exclusion list feature while running the full Parse Server test suite externally.

It should probably work like so:

  1. The adapter repo CI downloads the full Parse Server repo directly from GitHub based on a version tag. To ensure the adapter is compatible with specific versions, the CI could use a matrix to download multiple Parse Server major versions, e.g. the latest 5.x and 6.x. Downloading from npm wouldn't contain the tests as they are stripped from the published package.
  2. The CI modifies the DB adapter that Parse Server uses to run the tests. This may require some login the Parse Server repo test helper logic.
  3. The CI overrides the textExclusionList.json in Parse Server with the file defined in the adapter repo. So that Parse Server will exclude these tests. Or maybe more elegant, add an optional path param to the npm test command, so the CI just starts the CI by passing the file path.

mtrezza avatar Oct 23 '23 21:10 mtrezza

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

Created https://github.com/parse-community/parse-server-database-adapter-template to work on a POC.

mtrezza avatar Oct 25 '23 03:10 mtrezza

Hi @mtrezza

I cloned the template repo and have a few questions

  1. there is no .github folder and no ci.yml so how to clone parse server repo during build

  2. None of the spec files currently in parse server repo have a uuid so testing exclusion won't work For this one, maybe make a branch off alpha and just add uuids to a few tests in diff specs

  3. How to verify that the tests have been excluded at the end of the build

Thnks

ddrechse avatar Oct 25 '23 14:10 ddrechse

  1. The repo is empty, constructing the CI is part of the challenge, but I imagine to use parse server's ci.yml as a basis.
  2. That's correct; we would need to add an ID to a few tests where in a separate PR.
  3. The same way as in Parse Server. If we go with the suggested concept in https://github.com/parse-community/parse-server/issues/8788#issue-1958058793 then this repo will just copy the parse-server repo and run the test workflow the same way as in parse-server'S ci.yml file.

mtrezza avatar Oct 25 '23 17:10 mtrezza

The goal here is to provide a generic way that any new Parse Adapter repo can configure their own test exclusions. I am NOT a gihub actions guy but this is the idea as I understand it Here is an example

name: ci

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  clone-parse-server:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        version: ['5.0.0', '6.0.0']
    steps:
    - name: Checkout code
      uses: actions/checkout@v2
    - name: Clone parse-server ${{ matrix.version }}
      run: |
        git clone --depth 1 --branch ${{ matrix.version }} https://github.com/parse-community/parse-server.git parse-server-${{ matrix.version }}
    - name: Set test exclusion list
      run: # ...
    - name: Run CI
      run: npm run test

there would be a ci.yml in the adapter repo obviously cause you would need it to clone parse server repo I would imagine that in the root of the adapter repo, you could clone parse server into a subdirectory and then copy the specific adapter files into the corresponding sub-directory adapter location, cd into it and then run npm test as usual

From a discussion with @mtrezza You see, in the workflow, the steps are repeated 2 times, once for each version of Parse Server It clones Parse Server 5 into a directly, directly from GitHub, including all the test files, basically the whole repo Then you would just replace the test exclusion list by overwriting the file. set the db adapter Then you run the Parse Server CI I would break this all down and start wit this simple example here The first step would be to run the CI of cloned Parse Server Forgetting about test exclusions for a moment. Once this works, I would look at setting the test exclusion list by adding that step After that, I would look at how to replace the DB adapter, so that the test don’t run with the default adapter of the Parse Server repo, but with the adapter that you use in the DB adapter repository

Lastly, an automated way to verify that the tests have been excluded at the end of the build :)

ddrechse avatar Oct 26 '23 15:10 ddrechse