Skip to content

Commit

Permalink
[Backport 2.x] MultiDataSource feature merge (opensearch-project#2334)
Browse files Browse the repository at this point in the history
Signed-off-by: mpabba3003 <[email protected]>
  • Loading branch information
kristenTian authored and mpabba3003 committed Sep 23, 2022
1 parent ee4e304 commit b275b56
Show file tree
Hide file tree
Showing 142 changed files with 16,150 additions and 164 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/pr_check_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Setup Yarn
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
options: --user 1001
name: Run functional tests
strategy:
strategy:
matrix:
group: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ]
steps:
Expand All @@ -83,7 +83,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Setup Yarn
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
defaults:
run:
working-directory: ./artifacts
strategy:
strategy:
matrix:
include:
- name: Linux x64
Expand All @@ -139,7 +139,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version-file: "./artifacts/.nvmrc"
node-version-file: './artifacts/.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Setup Yarn
Expand Down Expand Up @@ -167,9 +167,9 @@ jobs:
name: ${{ matrix.suffix }}-${{ env.VERSION }}
path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }}
retention-days: 1

bwc-tests:
needs: [ build-min-artifact-tests ]
needs: [build-min-artifact-tests]
runs-on: ubuntu-latest
container:
image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
Expand All @@ -178,7 +178,7 @@ jobs:
defaults:
run:
working-directory: ./artifacts
strategy:
strategy:
matrix:
version: [ osd-1.3.2, osd-2.0.0, osd-2.1.0, osd-2.2.0 ]
steps:
Expand All @@ -193,7 +193,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version-file: "./artifacts/.nvmrc"
node-version-file: './artifacts/.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Setup Yarn
Expand All @@ -215,15 +215,15 @@ jobs:
if curl -I -L ${{ env.OPENSEARCH_URL }}; then
echo "::set-output name=version-exists::true"
fi
- name: Skipping tests
if: steps.verify-opensearch-exists.outputs.version-exists != 'true'
run: echo Tests were skipped because an OpenSearch release build does not exist for this version yet!

- name: Setting environment variable to run tests for ${{ matrix.version }}
if: steps.verify-opensearch-exists.outputs.version-exists == 'true'
run: echo "BWC_VERSIONS=${{ matrix.version }}" >> $GITHUB_ENV

- name: Download OpenSearch Dashboards
uses: actions/download-artifact@v3
id: download
Expand All @@ -236,7 +236,7 @@ jobs:
if: steps.verify-opensearch-exists.outputs.version-exists == 'true'
run: |
yarn test:bwc -s false -o ${{ env.OPENSEARCH_URL }} -d ${{ steps.download.outputs.download-path }}/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz -v ${{ matrix.version }}
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.verify-opensearch-exists.outputs.version-exists == 'true' }}
with:
Expand Down
1 change: 1 addition & 0 deletions .lycheeexclude
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ http://noone.nowhere.none/
http://bar
http://foo
http://test.com/
https://test.com/
https://manifest.foobar
https://files.foobar/
https://tiles.foobar/
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
]
},
"dependencies": {
"@aws-crypto/client-node": "^3.1.1",
"@elastic/datemath": "5.0.3",
"@elastic/eui": "npm:@opensearch-project/[email protected]",
"@elastic/good": "^9.0.1-kibana3",
Expand Down
19 changes: 12 additions & 7 deletions packages/osd-config-schema/src/types/stream_type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ test('includes namespace in failure', () => {
describe('#defaultValue', () => {
test('returns default when undefined', () => {
const value = new Stream();
expect(schema.stream({ defaultValue: value }).validate(undefined)).toMatchInlineSnapshot(`
Stream {
"_events": Object {},
"_eventsCount": 0,
"_maxListeners": undefined,
}
`);
expect(schema.stream({ defaultValue: value }).validate(undefined)).toHaveProperty(
'_events',
{}
);
expect(schema.stream({ defaultValue: value }).validate(undefined)).toHaveProperty(
'_eventsCount',
0
);
expect(schema.stream({ defaultValue: value }).validate(undefined)).toHaveProperty(
'_maxListeners',
undefined
);
});

test('returns value when specified', () => {
Expand Down
12 changes: 12 additions & 0 deletions src/core/server/http/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,23 @@ export class Router implements IRouter {
if (LegacyOpenSearchErrorHelpers.isNotAuthorizedError(e)) {
return e;
}

if (isDataSourceConfigError(e)) {
return hapiResponseAdapter.handle(
opensearchDashboardsResponseFactory.badRequest({ body: e.message })
);
}
// TODO: add legacy data source client config error handling

return hapiResponseAdapter.toInternalError();
}
}
}

const isDataSourceConfigError = (error: any) => {
return error.constructor.name === 'DataSourceConfigError' && error.statusCode === 400;
};

const convertOpenSearchUnauthorized = (
e: OpenSearchNotAuthorizedError
): ErrorHttpResponseOptions => {
Expand Down
3 changes: 3 additions & 0 deletions src/dev/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,7 @@ export default {
'<rootDir>/node_modules/enzyme-to-json/serializer',
],
reporters: ['default', '<rootDir>/src/dev/jest/junit_reporter.js'],
globals: {
Uint8Array: Uint8Array,
},
};
16 changes: 14 additions & 2 deletions src/fixtures/stubbed_saved_object_index_pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import stubbedLogstashFields from './logstash_fields';

const mockLogstashFields = stubbedLogstashFields();

export function stubbedSavedObjectIndexPattern(id: string | null = null) {
return {
export function stubbedSavedObjectIndexPattern(id: string | null = null, withDataSource?: false) {
const indexPattern: any = {
id,
type: 'index-pattern',
attributes: {
Expand All @@ -45,4 +45,16 @@ export function stubbedSavedObjectIndexPattern(id: string | null = null) {
},
version: '2',
};

if (withDataSource) {
indexPattern.reference = [
{
id: 'id',
name: 'name',
type: 'data-source',
},
];
}

return indexPattern;
}
Loading

0 comments on commit b275b56

Please sign in to comment.