-
Notifications
You must be signed in to change notification settings - Fork 29
Test HSDS API #1926
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
base: main
Are you sure you want to change the base?
Test HSDS API #1926
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,9 +30,11 @@ | |
| "lint:root:eslint": "eslint --max-warnings=0", | ||
| "lint:root:tsc": "tsc", | ||
| "test": "vitest", | ||
| "support:setup": "poetry -C support/sample install && poetry -C support/h5grove install", | ||
| "support:setup": "poetry -C support/sample install && poetry -C support/h5grove install && poetry -C support/hsds install", | ||
| "support:sample": "poetry -C support/sample run python create_h5_sample.py", | ||
| "support:h5grove": "poetry -C support/h5grove run python tornado_app.py --basedir ../sample/dist", | ||
| "support:hsds": "rm -rf support/hsds/hs.log && poetry -C support/hsds run hsds --root_dir . --config_dir ./config --password_file ./config/passwd.txt", | ||
| "support:hsds:load": "rm -rf support/hsds/root/* && poetry -C support/hsds run hsload -e http://localhost:5101 -u test -p test --link ../sample/dist/sample-hsds.h5 /", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| "cypress": "cypress open --e2e", | ||
| "cypress:run": "cypress run --e2e", | ||
| "version": "pnpm -r sync-version && git add .", | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the snapshot file. I've already identified a few issues/inconsistencies with other providers, like a few "Unknown" dtypes, which I'll try to fix. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { | ||
| assertDataset, | ||
| assertEnvVar, | ||
| assertGroup, | ||
| assertGroupWithChildren, | ||
| hasNonNullShape, | ||
| } from '@h5web/shared/guards'; | ||
| import { beforeAll, expect, test } from 'vitest'; | ||
|
|
||
| import { assertListeningAt } from '../../test-utils'; | ||
| import { getValueOrError } from '../utils'; | ||
| import { HsdsApi } from './hsds-api'; | ||
|
|
||
| const SKIP = import.meta.env.VITE_HSDS_SKIP === 'true'; | ||
| const HSDS_URL = import.meta.env.VITE_HSDS_URL; | ||
| const HSDS_TEST_DOMAIN = import.meta.env.VITE_HSDS_TEST_DOMAIN; | ||
| assertEnvVar(HSDS_URL, 'VITE_HSDS_URL'); | ||
| assertEnvVar(HSDS_TEST_DOMAIN, 'VITE_HSDS_TEST_DOMAIN'); | ||
|
|
||
| beforeAll(async () => { | ||
| await assertListeningAt(HSDS_URL); | ||
| }); | ||
|
|
||
| test.skipIf(SKIP)('test file matches snapshot', async () => { | ||
| const api = new HsdsApi(HSDS_URL, HSDS_TEST_DOMAIN); | ||
|
|
||
| const root = await api.getEntity('/'); | ||
| assertGroup(root); | ||
| assertGroupWithChildren(root); | ||
|
|
||
| const children = await Promise.all( | ||
| root.children.map(async (child) => { | ||
| assertDataset(child); | ||
| const { name, shape, type, rawType } = child; | ||
|
|
||
| const value = hasNonNullShape(child) | ||
| ? await getValueOrError(api, child) | ||
| : null; | ||
|
|
||
| return { name, shape, type, rawType, value }; | ||
| }), | ||
| ); | ||
|
|
||
| expect(children).toMatchSnapshot(); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,8 +24,8 @@ import { | |
| } from '@h5web/shared/vis-models'; | ||
|
|
||
| import { DataProviderApi } from '../api'; | ||
| import { type Fetcher, type ValuesStoreParams } from '../models'; | ||
| import { FetcherError, toJSON } from '../utils'; | ||
| import { type ValuesStoreParams } from '../models'; | ||
| import { createBasicFetcher, FetcherError, toJSON } from '../utils'; | ||
| import { | ||
| type BaseHsdsEntity, | ||
| type HsdsAttribute, | ||
|
|
@@ -60,7 +60,7 @@ export class HsdsApi extends DataProviderApi { | |
| public constructor( | ||
| private readonly baseURL: string, | ||
| filepath: string, | ||
| private readonly fetcher: Fetcher, | ||
| private readonly fetcher = createBasicFetcher(), | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've managed to configure the HSDS support server to allow unauthenticated requests, so I'm making the |
||
| private readonly _getExportURL?: DataProviderApi['getExportURL'], | ||
| ) { | ||
| super(filepath); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| default_public: True # allow unauthorized read access | ||
| bucket_name: root | ||
| admin_user: test | ||
| max_task_count: 10000 # allow more parallel requests | ||
| log_level: WARN # increased from INFO |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| test:test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rootis the name of the default bucket,a s configured insupport/hsds/config/override.ymlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use a more explicit name e.g.
test-bucket