6bb8df6a26
### Description Add console support for Citus DB ### Changelist - [x] Add/Remove Citus Datasource - [x] Track/Untrack tables - [x] Create Relationships + Tracking suggested relationships - [x] Permissions - [x] Browse Rows (minimal) - [x] Insert Row (using Mutations) - [x] Filtering Shards and Partitions (partition details are not present in Modify tab, it should work once https://github.com/hasura/graphql-engine-mono/pull/1164 is merged) - [x] Create Table - [x] Fixes issue https://github.com/hasura/graphql-engine/issues/6926 for Citus. ### Known Issues - Unable to create Functions from Raw SQL, server returns 400. - Unable to run `ALTER` SQL commands, server returns 400. ### Screenshots ![Screenshot 2021-04-21 at 7 53 23 PM](https://user-images.githubusercontent.com/11921040/115569900-468b3d80-a2db-11eb-8374-e06d5d61b2e4.png) ### Setting up a Citus Source - Link to [docker compose](https://github.com/citusdata/docker/blob/master/docker-compose.yml) - Create an `.envfile` and add the following ```env COORDINATOR_EXTERNAL_PORT=<port to expose citus master> COMPOSE_PROJECT_NAME=test ``` - run `docker-compose --file docker-compose.yml --env-file .envfile up --scale worker=2 -d`. `worker` controls the number of citus worker nodes. - Link to [sample data](http://docs.citusdata.com/en/v10.0/get_started/tutorial_multi_tenant.html#data-model-and-sample-data) ### Changelog - [x] console: add citus support https://github.com/hasura/graphql-engine-mono/pull/1184 Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com> GitOrigin-RevId: 2500a5d5f996a2904fe8b5c656d6f3f2db707db6 |
||
---|---|---|
.. | ||
fixtures | ||
helpers | ||
integration | ||
plugins | ||
support | ||
.eslintrc | ||
global.d.ts | ||
README.md | ||
tsconfig.json |
Test
Running all tests to generate coverage
- Set the
TEST_MODE
field incypress.json
tocli
- Run the command
npm run test
from theconsole
directory to run all the tests.
You can also run the complete tests from the cypress electron app:
- Set the
TEST_MODE
field incypress.json
tocli
- Run
npm run cypress
from theconsole
directory. - Click on
test_complete.js
Running tests individually
Tests are modularized into following modules:
- API-Explorer
- Data
- Migration Mode
- Create Table
- Insert Browse
- Modify Table
- Table Relationships
- Table and View Permissions
- Views
To run the tests for the modules individually (say for create table),
- Go to the
cypress.json
and set theenv > TEST_MODE
variable toui
.
{
"env": {
"TEST_MODE": "ui"
}
}
- Run the command
npm run cypress
and click oncreate-table > test.js
Writing Tests
-
Read ups
-
If this is your first time with cypress, check out this getting started guide
-
Read cypress best practices
-
-
File Structure
The top-level directories in console/cypress are auto-generated by cypress except helpers. To understand the use of each directory check out Folder Structure
helpers directory is used for sharing reusable functions/constants across tests. Before adding a resubale function in this directory, consider if it will be better as a custom cypress command, if so, then add it to Support directory following this guide, preferrably to command.ts file.
-
Adding a Test
Tests go to integration directory, where there are folders corresponding to Components in Services directory (The top-level routes on the console).
Each of these folders contains different test folders, named after the particular feature they are testing. For example create-table folder tests the functionality of creating a table from the console UI.