PalisadoesFoundation / talawa-api

API Backend for the Talawa Mobile App. Click on the link below to see our documentation
https://docs.talawa.io/
GNU General Public License v3.0
224 stars 816 forks source link

Create a setup script for the `develop-postgres` branch #2688

Open palisadoes opened 2 days ago

palisadoes commented 2 days ago

Is your feature request related to a problem? Please describe.

  1. We need a setup script to configure the new develop-postgres branch.
  2. The functionality must be equivalent to the setup script in the develop branch

Describe the solution you'd like

PRs related to setup.ts require a high degree of manual verification by our reviewers and errors are frequent.

  1. We frequently add new configuration parameters to our code base.
  2. The changes mean that the setup.ts file is always being modified.
  3. Most PRs that modify this file introduce various types of failure.

Your job is to make the execution of the setup.ts file be:

  1. foolproof
  2. intuitive to use
  3. easier and simpler to use

A tech novice or new contributor should be able to install the API without issue.

For the successful completion of this issue:

  1. Write code to thoroughly test the setup.ts file without manually inputting responses to prompts, including:
    1. all relevant functions, methods and classes where applicable.
    2. all user prompts
  2. Ensure that running the tests is a part of our existing PR and Husky git commit workflows

This may mean making changes to the setup.ts file.

Describe alternatives you've considered

Approach to be followed (optional)

This issue may require the refactoring of this script file to make it:

  1. Easier to test
  2. Easier to maintain

Testing must verify that the:

  1. Default values for input are correct:
    1. When a parameter is already configured
    2. When a parameter is not configured
  2. Functionality when parameters are missing from the configuration is maintained
  3. Sequencing of the prompts is maintained
  4. Configuration parameters that rely on any external APIs (eg. database, mail) must be tested.
    1. The tests don't hang when testing these APIs whether or not the API connectivity is validated
  5. Preexisting comments in the test configuration file are maintained when the final configuration is saved
  6. Final configuration isn't saved until the last question is answered. In other words, hitting CTRL-C at any point before the last question will not affect the original configuration.
  7. Wording of the prompts in all scenarios is unchanged
  8. Test database loads without issue
  9. Previously correctly answered questions are not repeated
  10. Correct values are echoed when:
    1. entered,
    2. updated or
    3. previously found in the configuration
  11. Prompts correctly bypass sections that the user doesn't want to configure.
    1. For example, there are multiple SMTP and Redis configuration parameters.
      1. Optional parameter sections: If the person installing the API doesn't want to update SMTP parameters they should be skipped, otherwise prompted
      2. Mandatory parameter sections: If the person installing the API doesn't want to update configured mandatory Redis parameters, they should be skipped, otherwise prompted
  12. Input of mandatory parameters cannot be avoided if they are not previously configured

Plus any other tests that could avoid failure based on the PR comments for the issues below.

Other items to consider include:

  1. The test file must be located in the existing tests/ directory
  2. The test file has good readability
  3. Not making any changes to files in the .github directory

Additional context

These are issues where setup has been modified and in most cases have introduced more errors:

  1. https://github.com/PalisadoesFoundation/talawa-api/issues/1680

Potential internship candidates Please read this if you are planning to apply for a Palisadoes Foundation internship

yuvi-mittal commented 2 days ago

can i get assigned to this issue ?