This is an automated email from the ASF dual-hosted git repository. maximebeauchemin pushed a commit to branch doc_psql in repository https://gitbox.apache.org/repos/asf/superset.git
commit 0377e91427df1183abba400978afcd5d450e8852 Author: Maxime Beauchemin <[email protected]> AuthorDate: Wed Jan 15 10:12:02 2025 -0800 docs: add a note about accessing the dev env's postgres database This came up in a conversation and thought it'd be good to document it. --- docs/docs/contributing/development.mdx | 11 +++++++++++ .../src/features/home/EmptyState.test.tsx | 18 ++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/docs/contributing/development.mdx b/docs/docs/contributing/development.mdx index 56ff001536..fc30301c9a 100644 --- a/docs/docs/contributing/development.mdx +++ b/docs/docs/contributing/development.mdx @@ -89,6 +89,17 @@ For more env vars that affect your configuration, see this [superset_config.py](https://github.com/apache/superset/blob/master/docker/pythonpath_dev/superset_config.py) used in the `docker compose` context to assign env vars to the superset configuration. +### Accessing the postgres database +Sometimes it's useful to access the database in the docker container directly. +You can enter a `psql` shell (the official Postgres client) by running the following command: + +```bash +docker compose exec db psql -U superset +``` + +Also note that the database is exposed on port 5432, so you can connect to it using your favorite +Postgres client or even SQL Lab itselft directly in Superset by creating a new database connection +to `localhost:5432`. ### Nuking the postgres database diff --git a/superset-frontend/src/features/home/EmptyState.test.tsx b/superset-frontend/src/features/home/EmptyState.test.tsx index 7506b3d0f1..fe633bc788 100644 --- a/superset-frontend/src/features/home/EmptyState.test.tsx +++ b/superset-frontend/src/features/home/EmptyState.test.tsx @@ -62,11 +62,14 @@ describe('EmptyState', () => { tableName: WelcomeTable.Recents, }, ]; + variants.forEach(variant => { - it(`it renders an ${variant.tab} ${variant.tableName} empty state`, () => { + it(`renders an ${variant.tab} ${variant.tableName} empty state`, () => { const wrapper = mount(<EmptyState {...variant} />); expect(wrapper).toExist(); - const textContainer = wrapper.find('.ant-empty-description'); + + // Select the first description node + const textContainer = wrapper.find('.ant-empty-description').at(0); expect(textContainer.text()).toEqual( variant.tab === TableTab.Favorite ? "You don't have any favorites yet!" @@ -79,12 +82,19 @@ describe('EmptyState', () => { expect(wrapper.find('button')).toHaveLength(1); }); }); + recents.forEach(recent => { - it(`it renders a ${recent.tab} ${recent.tableName} empty state`, () => { + it(`renders a ${recent.tab} ${recent.tableName} empty state`, () => { const wrapper = mount(<EmptyState {...recent} />); expect(wrapper).toExist(); - const textContainer = wrapper.find('.ant-empty-description'); + + // Select the first description node + const textContainer = wrapper.find('.ant-empty-description').at(0); + + // Validate the image expect(wrapper.find('.ant-empty-image').children()).toHaveLength(1); + + // Check the correct text is displayed expect(textContainer.text()).toContain( `Recently ${recent.tab?.toLowerCase()} charts, dashboards, and saved queries will appear here`, );
