Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock data for E2E tests #129

Merged
merged 15 commits into from
Oct 30, 2023
Empty file removed docker-compose.yml
Empty file.
3 changes: 3 additions & 0 deletions tests/data/create-sales-db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE USER e2e WITH PASSWORD 'e2e';
ALTER USER e2e WITH SUPERUSER;
CREATE DATABASE sales OWNER e2e;
5 changes: 5 additions & 0 deletions tests/data/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Setting up a sales database
psql -f /opt/e2e-data/create-sales-db.sql postgres://world:world123@postgres-connection/postgres

# Filling data into the sales database
psql -f /opt/e2e-data/superstore-sales.sql postgres://e2e:e2e@postgres-connection/sales
File renamed without changes.
22 changes: 1 addition & 21 deletions tests/data/superstore-sales.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,7 @@ CREATE TABLE sales (
sales TEXT NOT NULL
);

COPY sales (
id,
order_id,
order_date,
ship_date,
ship_mode,
customer_id,
customer_name,
segment,
country,
city,
state,
postal_code,
region,
product_id,
category,
sub_category,
product_name,
sales
)
FROM './superstore_sales.csv' DELIMITER ',' CSV HEADER;
\COPY sales FROM '/opt/e2e-data/superstore-sales.csv' DELIMITER ',' CSV HEADER;

ALTER TABLE ONLY sales ADD CONSTRAINT sales_pkey PRIMARY KEY (id);

Expand Down
9 changes: 9 additions & 0 deletions tests/data/us-e2e-data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
INSERT INTO public.workbooks VALUES (1540491943966934028, 'E2E Workbook', 'A workbook for running E2E tests', NULL, 'common', '{}', 'systemId', '2023-10-27 08:22:30.193066+00', NULL, false, NULL, NULL, 'systemId', '2023-10-27 08:22:30.193066+00', 'e2e workbook', '\x4500313132004520576f726b626f6f6b');

INSERT INTO public.entries VALUES ('connection', 'postgres', '1540492113307763725/connection', NULL, 'uid:systemId', '2023-10-27 08:22:50.373279+00', 'uid:systemId', '2023-10-27 08:22:50.373279+00', false, NULL, false, '1540492113307763725/Connection', 1540492113307763725, 1540492113324540942, NULL, 'common', 'connection', '\x636f6e6e656374696f6e', false, '{"password": {"key_id": "key_1", "key_kind": "local_fernet", "cypher_text": "gAAAAABlO3NaP2qKbOPjG3b03FfSrzo-E9MRaR7AD_ibIqo1jQ3a3jILDPjQ13I8K3tWXadrYCA4d2SSyUesCPxHQWty6UNlCA=="}}', 1540491943966934028);
INSERT INTO public.entries VALUES ('dataset', '', '1540492265879766031/dataset', NULL, 'uid:systemId', '2023-10-27 08:23:08.567859+00', 'uid:systemId', '2023-10-27 08:23:08.567859+00', false, NULL, false, '1540492265879766031/Dataset', 1540492265879766031, 1540492265879766032, NULL, 'common', 'dataset', '\x64617461736574', false, '{}', 1540491943966934028);

INSERT INTO public.revisions VALUES ('{"host": "postgres-connection", "name": null, "port": 5432, "ssl_ca": null, "db_name": "sales", "username": "e2e", "ssl_enable": false, "table_name": null, "cache_ttl_sec": null, "raw_sql_level": "dashsql", "enforce_collate": "auto", "sample_table_name": null, "data_export_forbidden": false}', '{"state": "saved"}', 'uid:systemId', '2023-10-27 08:22:50.373279+00', 'uid:systemId', '2023-10-27 08:22:50.373279+00', 1540492113324540942, 1540492113307763725, '{}');
INSERT INTO public.revisions VALUES ('{"rls": [], "name": "", "revision_id": null, "result_schema": [{"cast": "integer", "guid": "id", "type": "DIMENSION", "title": "id", "valid": true, "hidden": false, "source": "id", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "integer", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "integer", "has_auto_aggregation": false}, {"cast": "string", "guid": "order_id", "type": "DIMENSION", "title": "order_id", "valid": true, "hidden": false, "source": "order_id", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "date", "guid": "order_date", "type": "DIMENSION", "title": "order_date", "valid": true, "hidden": false, "source": "order_date", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "date", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "date", "has_auto_aggregation": false}, {"cast": "date", "guid": "ship_date", "type": "DIMENSION", "title": "ship_date", "valid": true, "hidden": false, "source": "ship_date", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "date", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "date", "has_auto_aggregation": false}, {"cast": "string", "guid": "ship_mode", "type": "DIMENSION", "title": "ship_mode", "valid": true, "hidden": false, "source": "ship_mode", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "customer_id", "type": "DIMENSION", "title": "customer_id", "valid": true, "hidden": false, "source": "customer_id", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "customer_name", "type": "DIMENSION", "title": "customer_name", "valid": true, "hidden": false, "source": "customer_name", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "segment", "type": "DIMENSION", "title": "segment", "valid": true, "hidden": false, "source": "segment", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "country", "type": "DIMENSION", "title": "country", "valid": true, "hidden": false, "source": "country", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "city", "type": "DIMENSION", "title": "city", "valid": true, "hidden": false, "source": "city", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "state", "type": "DIMENSION", "title": "state", "valid": true, "hidden": false, "source": "state", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "postal_code", "type": "DIMENSION", "title": "postal_code", "valid": true, "hidden": false, "source": "postal_code", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "region", "type": "DIMENSION", "title": "region", "valid": true, "hidden": false, "source": "region", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "product_id", "type": "DIMENSION", "title": "product_id", "valid": true, "hidden": false, "source": "product_id", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "category", "type": "DIMENSION", "title": "category", "valid": true, "hidden": false, "source": "category", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "sub_category", "type": "DIMENSION", "title": "sub_category", "valid": true, "hidden": false, "source": "sub_category", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "product_name", "type": "DIMENSION", "title": "product_name", "valid": true, "hidden": false, "source": "product_name", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}, {"cast": "string", "guid": "sales", "type": "DIMENSION", "title": "sales", "valid": true, "hidden": false, "source": "sales", "formula": "", "avatar_id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "calc_mode": "direct", "data_type": "string", "managed_by": "user", "aggregation": "none", "description": "", "guid_formula": "", "default_value": null, "lock_aggregation": false, "value_constraint": null, "initial_data_type": "string", "has_auto_aggregation": false}], "source_avatars": [{"id": "0ba65c40-74a2-11ee-b89b-1b09465ddead", "title": "public.sales", "valid": true, "is_root": true, "source_id": "0ba65c41-74a2-11ee-b89b-1b09465ddead", "managed_by": "user"}], "avatar_relations": [], "component_errors": {"items": []}, "result_schema_aux": {"inter_dependencies": {"deps": []}}, "obligatory_filters": [], "source_collections": [{"id": "0ba65c41-74a2-11ee-b89b-1b09465ddead", "type": "collection", "title": "sales", "valid": true, "origin": {"parameters": {"db_version": "PostgreSQL 15.4 (Debian 15.4-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit", "table_name": "sales", "schema_name": "public"}, "raw_schema": [{"name": "id", "type": "integer", "title": "id", "nullable": false, "description": "", "native_type": {"name": "integer", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "order_id", "type": "string", "title": "order_id", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "order_date", "type": "date", "title": "order_date", "nullable": false, "description": "", "native_type": {"name": "date", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "ship_date", "type": "date", "title": "ship_date", "nullable": false, "description": "", "native_type": {"name": "date", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "ship_mode", "type": "string", "title": "ship_mode", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "customer_id", "type": "string", "title": "customer_id", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "customer_name", "type": "string", "title": "customer_name", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "segment", "type": "string", "title": "segment", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "country", "type": "string", "title": "country", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "city", "type": "string", "title": "city", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "state", "type": "string", "title": "state", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "postal_code", "type": "string", "title": "postal_code", "nullable": true, "description": "", "native_type": {"name": "text", "nullable": true, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "region", "type": "string", "title": "region", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "product_id", "type": "string", "title": "product_id", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "category", "type": "string", "title": "category", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "sub_category", "type": "string", "title": "sub_category", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "product_name", "type": "string", "title": "product_name", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}, {"name": "sales", "type": "string", "title": "sales", "nullable": false, "description": "", "native_type": {"name": "text", "nullable": false, "conn_type": "postgres", "native_type_class_name": "common_native_type"}, "lock_aggregation": false, "has_auto_aggregation": false}], "created_from": "PG_TABLE", "connection_id": "0e1zkcqgfoyep"}, "sample": null, "managed_by": "user", "materialization": null}]}', '{"created_via": "user"}', 'uid:systemId', '2023-10-27 08:23:08.567859+00', 'uid:systemId', '2023-10-27 08:23:08.567859+00', 1540492265879766032, 1540492265879766031, '{"0ba65c41-74a2-11ee-b89b-1b09465ddead": "0e1zkcqgfoyep"}');

INSERT INTO public.links VALUES (1540492265879766031, 1540492113307763725, '0ba65c41-74a2-11ee-b89b-1b09465ddead');
16 changes: 16 additions & 0 deletions tests/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
version: "3.7"

services:
us:
build:
context: ../datalens-us
dockerfile: ../datalens-us/Dockerfile
bt4R9 marked this conversation as resolved.
Show resolved Hide resolved
depends_on:
- postgres-connection
environment:
USE_E2E_MOCK_DATA: 1
volumes:
- e2e-data-volume:/opt/e2e-data

datalens:
build:
context: ../datalens-ui
dockerfile: ../datalens-ui/Dockerfile
image: result/latest
volumes:
- e2e-data-volume:/opt/app/tests/data

volumes:
e2e-data-volume: