Web console basic end-to-end-test (#9595)
Load data and query (i.e., automate
https://druid.apache.org/docs/latest/tutorials/tutorial-batch.html) to
have some basic checks ensuring the web console is wired up to druid
correctly.
The new end-to-end tests (tutorial-batch.spec.ts) are added to
`web-console/e2e-tests`. Within that directory:
- `components` represent the various tabs of the web console. Currently,
abstractions for `load data`, `ingestion`, `datasources`, and `query`
are implemented.
- `components/load-data/data-connector` contains abstractions for the
different data source options available to the data loader's `Connect`
step. Currently, only the `Local file` data source connector is
implemented.
- `components/load-data/config` contains abstractions for the different
configuration options available for each step of the data loader flow.
Currently, the `Configure Schema`, `Partition`, and `Publish` steps
have initial implementation of their configuration options.
- `util` contains various helper methods for the tests and does not
contain abstractions of the web console.
Changes to add the new tests to CI:
- `.travis.yml`: New "web console end-to-end tests" job
- `web-console/jest.*.js`: Refactor jest configurations to have
different flavors for unit tests and for end-to-end tests. In
particular, the latter adds a jest setup configuration to wait for the
web console to be ready (`web-console/e2e-tests/util/setup.ts`).
- `web-console/package.json`: Refactor run scripts to add new script for
running end-to-end tests.
- `web-console/script/druid`: Utility scripts for building, starting,
and stopping druid.
Other changes:
- `pom.xml`: Refactor various settings disable java static checks and to
disable java tests into two new maven profiles. Since the same
settings are used in several places (e.g., .travis.yml, Dockerfiles,
etc.), having them in maven profiles makes it more maintainable.
- `web-console/src/console-application.tsx`: Fix typo ("the the").
2020-04-09 15:38:09 -04:00
|
|
|
/*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
|
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2021-04-22 22:33:03 -04:00
|
|
|
/* eslint-disable max-classes-per-file */
|
|
|
|
|
2020-10-03 11:21:44 -04:00
|
|
|
import * as playwright from 'playwright-chromium';
|
2020-10-01 18:14:41 -04:00
|
|
|
|
2022-01-12 06:50:10 -05:00
|
|
|
import {
|
|
|
|
getLabeledInput,
|
|
|
|
getLabeledTextarea,
|
|
|
|
selectSuggestibleInput,
|
|
|
|
setLabeledInput,
|
|
|
|
setLabeledTextarea,
|
|
|
|
} from '../../../util/playwright';
|
2020-10-01 18:14:41 -04:00
|
|
|
|
Web console basic end-to-end-test (#9595)
Load data and query (i.e., automate
https://druid.apache.org/docs/latest/tutorials/tutorial-batch.html) to
have some basic checks ensuring the web console is wired up to druid
correctly.
The new end-to-end tests (tutorial-batch.spec.ts) are added to
`web-console/e2e-tests`. Within that directory:
- `components` represent the various tabs of the web console. Currently,
abstractions for `load data`, `ingestion`, `datasources`, and `query`
are implemented.
- `components/load-data/data-connector` contains abstractions for the
different data source options available to the data loader's `Connect`
step. Currently, only the `Local file` data source connector is
implemented.
- `components/load-data/config` contains abstractions for the different
configuration options available for each step of the data loader flow.
Currently, the `Configure Schema`, `Partition`, and `Publish` steps
have initial implementation of their configuration options.
- `util` contains various helper methods for the tests and does not
contain abstractions of the web console.
Changes to add the new tests to CI:
- `.travis.yml`: New "web console end-to-end tests" job
- `web-console/jest.*.js`: Refactor jest configurations to have
different flavors for unit tests and for end-to-end tests. In
particular, the latter adds a jest setup configuration to wait for the
web console to be ready (`web-console/e2e-tests/util/setup.ts`).
- `web-console/package.json`: Refactor run scripts to add new script for
running end-to-end tests.
- `web-console/script/druid`: Utility scripts for building, starting,
and stopping druid.
Other changes:
- `pom.xml`: Refactor various settings disable java static checks and to
disable java tests into two new maven profiles. Since the same
settings are used in several places (e.g., .travis.yml, Dockerfiles,
etc.), having them in maven profiles makes it more maintainable.
- `web-console/src/console-application.tsx`: Fix typo ("the the").
2020-04-09 15:38:09 -04:00
|
|
|
/**
|
|
|
|
* Possible values for partition step segment granularity.
|
|
|
|
*/
|
|
|
|
export enum SegmentGranularity {
|
2020-11-17 16:25:03 -05:00
|
|
|
HOUR = 'hour',
|
|
|
|
DAY = 'day',
|
|
|
|
MONTH = 'month',
|
|
|
|
YEAR = 'year',
|
Web console basic end-to-end-test (#9595)
Load data and query (i.e., automate
https://druid.apache.org/docs/latest/tutorials/tutorial-batch.html) to
have some basic checks ensuring the web console is wired up to druid
correctly.
The new end-to-end tests (tutorial-batch.spec.ts) are added to
`web-console/e2e-tests`. Within that directory:
- `components` represent the various tabs of the web console. Currently,
abstractions for `load data`, `ingestion`, `datasources`, and `query`
are implemented.
- `components/load-data/data-connector` contains abstractions for the
different data source options available to the data loader's `Connect`
step. Currently, only the `Local file` data source connector is
implemented.
- `components/load-data/config` contains abstractions for the different
configuration options available for each step of the data loader flow.
Currently, the `Configure Schema`, `Partition`, and `Publish` steps
have initial implementation of their configuration options.
- `util` contains various helper methods for the tests and does not
contain abstractions of the web console.
Changes to add the new tests to CI:
- `.travis.yml`: New "web console end-to-end tests" job
- `web-console/jest.*.js`: Refactor jest configurations to have
different flavors for unit tests and for end-to-end tests. In
particular, the latter adds a jest setup configuration to wait for the
web console to be ready (`web-console/e2e-tests/util/setup.ts`).
- `web-console/package.json`: Refactor run scripts to add new script for
running end-to-end tests.
- `web-console/script/druid`: Utility scripts for building, starting,
and stopping druid.
Other changes:
- `pom.xml`: Refactor various settings disable java static checks and to
disable java tests into two new maven profiles. Since the same
settings are used in several places (e.g., .travis.yml, Dockerfiles,
etc.), having them in maven profiles makes it more maintainable.
- `web-console/src/console-application.tsx`: Fix typo ("the the").
2020-04-09 15:38:09 -04:00
|
|
|
}
|
|
|
|
|
2020-10-01 18:14:41 -04:00
|
|
|
const PARTITIONING_TYPE = 'Partitioning type';
|
|
|
|
|
|
|
|
export interface PartitionsSpec {
|
|
|
|
readonly type: string;
|
|
|
|
apply(page: playwright.Page): Promise<void>;
|
|
|
|
}
|
|
|
|
|
2020-10-02 02:59:21 -04:00
|
|
|
export async function readPartitionSpec(page: playwright.Page): Promise<PartitionsSpec | null> {
|
|
|
|
const type = await getLabeledInput(page, PARTITIONING_TYPE);
|
|
|
|
switch (type) {
|
|
|
|
case HashedPartitionsSpec.TYPE:
|
|
|
|
return HashedPartitionsSpec.read(page);
|
2022-01-12 06:50:10 -05:00
|
|
|
case RangePartitionsSpec.TYPE:
|
|
|
|
return RangePartitionsSpec.read(page);
|
2020-10-02 02:59:21 -04:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-10-01 18:14:41 -04:00
|
|
|
export class HashedPartitionsSpec implements PartitionsSpec {
|
2020-10-02 02:59:21 -04:00
|
|
|
public static TYPE = 'hashed';
|
2021-04-22 22:33:03 -04:00
|
|
|
private static readonly NUM_SHARDS = 'Num shards';
|
2020-10-02 02:59:21 -04:00
|
|
|
|
2020-10-01 18:14:41 -04:00
|
|
|
readonly type: string;
|
|
|
|
|
2020-10-02 02:59:21 -04:00
|
|
|
static async read(page: playwright.Page): Promise<HashedPartitionsSpec> {
|
2021-05-27 19:36:42 -04:00
|
|
|
// The shards control may not be visible in that case this is not an error, it is simply not set (null)
|
|
|
|
let numShards: number | null = null;
|
|
|
|
try {
|
|
|
|
numShards = await getLabeledInputAsNumber(page, HashedPartitionsSpec.NUM_SHARDS);
|
|
|
|
} catch {}
|
2020-10-02 02:59:21 -04:00
|
|
|
return new HashedPartitionsSpec({ numShards });
|
|
|
|
}
|
|
|
|
|
2020-10-01 18:14:41 -04:00
|
|
|
constructor(props: HashedPartitionsSpecProps) {
|
|
|
|
Object.assign(this, props);
|
2020-10-02 02:59:21 -04:00
|
|
|
this.type = HashedPartitionsSpec.TYPE;
|
2020-10-01 18:14:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
async apply(page: playwright.Page): Promise<void> {
|
|
|
|
await setLabeledInput(page, PARTITIONING_TYPE, this.type);
|
|
|
|
if (this.numShards != null) {
|
2020-10-02 02:59:21 -04:00
|
|
|
await setLabeledInput(page, HashedPartitionsSpec.NUM_SHARDS, String(this.numShards));
|
2020-10-01 18:14:41 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-02 02:59:21 -04:00
|
|
|
async function getLabeledInputAsNumber(
|
|
|
|
page: playwright.Page,
|
|
|
|
label: string,
|
|
|
|
): Promise<number | null> {
|
|
|
|
const valueString = await getLabeledInput(page, label);
|
|
|
|
return valueString === '' ? null : Number(valueString);
|
|
|
|
}
|
|
|
|
|
2022-01-12 06:50:10 -05:00
|
|
|
async function getLabeledTextareaAsArray(page: playwright.Page, label: string): Promise<string[]> {
|
|
|
|
const valueString = await getLabeledTextarea(page, label);
|
|
|
|
return valueString === '' ? [] : valueString.split(',').map(v => v.trim());
|
|
|
|
}
|
|
|
|
|
2020-10-01 18:14:41 -04:00
|
|
|
interface HashedPartitionsSpecProps {
|
|
|
|
readonly numShards: number | null;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface HashedPartitionsSpec extends HashedPartitionsSpecProps {}
|
|
|
|
|
2022-01-12 06:50:10 -05:00
|
|
|
export class RangePartitionsSpec implements PartitionsSpec {
|
|
|
|
public static TYPE = 'range';
|
|
|
|
private static readonly PARTITION_DIMENSIONS = 'Partition dimensions';
|
2021-04-22 22:33:03 -04:00
|
|
|
private static readonly TARGET_ROWS_PER_SEGMENT = 'Target rows per segment';
|
|
|
|
private static readonly MAX_ROWS_PER_SEGMENT = 'Max rows per segment';
|
2020-10-02 02:59:21 -04:00
|
|
|
|
2020-10-01 18:14:41 -04:00
|
|
|
readonly type: string;
|
|
|
|
|
2022-01-12 06:50:10 -05:00
|
|
|
static async read(page: playwright.Page): Promise<RangePartitionsSpec> {
|
|
|
|
const partitionDimensions = await getLabeledTextareaAsArray(
|
2020-10-02 02:59:21 -04:00
|
|
|
page,
|
2022-01-12 06:50:10 -05:00
|
|
|
RangePartitionsSpec.PARTITION_DIMENSIONS,
|
2020-10-02 02:59:21 -04:00
|
|
|
);
|
|
|
|
const targetRowsPerSegment = await getLabeledInputAsNumber(
|
|
|
|
page,
|
2022-01-12 06:50:10 -05:00
|
|
|
RangePartitionsSpec.TARGET_ROWS_PER_SEGMENT,
|
2020-10-02 02:59:21 -04:00
|
|
|
);
|
|
|
|
const maxRowsPerSegment = await getLabeledInputAsNumber(
|
|
|
|
page,
|
2022-01-12 06:50:10 -05:00
|
|
|
RangePartitionsSpec.MAX_ROWS_PER_SEGMENT,
|
2020-10-02 02:59:21 -04:00
|
|
|
);
|
2022-01-12 06:50:10 -05:00
|
|
|
return new RangePartitionsSpec({
|
|
|
|
partitionDimensions,
|
2020-10-02 02:59:21 -04:00
|
|
|
targetRowsPerSegment,
|
|
|
|
maxRowsPerSegment,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-01-12 06:50:10 -05:00
|
|
|
constructor(props: RangePartitionsSpecProps) {
|
2020-10-01 18:14:41 -04:00
|
|
|
Object.assign(this, props);
|
2022-01-12 06:50:10 -05:00
|
|
|
this.type = RangePartitionsSpec.TYPE;
|
2020-10-01 18:14:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
async apply(page: playwright.Page): Promise<void> {
|
|
|
|
await selectSuggestibleInput(page, PARTITIONING_TYPE, this.type);
|
2022-01-12 06:50:10 -05:00
|
|
|
await setLabeledTextarea(
|
2020-10-02 02:59:21 -04:00
|
|
|
page,
|
2022-01-12 06:50:10 -05:00
|
|
|
RangePartitionsSpec.PARTITION_DIMENSIONS,
|
|
|
|
this.partitionDimensions.join(', '),
|
2020-10-02 02:59:21 -04:00
|
|
|
);
|
2020-10-01 18:14:41 -04:00
|
|
|
if (this.targetRowsPerSegment) {
|
2020-10-02 02:59:21 -04:00
|
|
|
await setLabeledInput(
|
|
|
|
page,
|
2022-01-12 06:50:10 -05:00
|
|
|
RangePartitionsSpec.TARGET_ROWS_PER_SEGMENT,
|
2020-10-02 02:59:21 -04:00
|
|
|
String(this.targetRowsPerSegment),
|
|
|
|
);
|
2020-10-01 18:14:41 -04:00
|
|
|
}
|
|
|
|
if (this.maxRowsPerSegment) {
|
2020-10-02 02:59:21 -04:00
|
|
|
await setLabeledInput(
|
|
|
|
page,
|
2022-01-12 06:50:10 -05:00
|
|
|
RangePartitionsSpec.MAX_ROWS_PER_SEGMENT,
|
2020-10-02 02:59:21 -04:00
|
|
|
String(this.maxRowsPerSegment),
|
|
|
|
);
|
2020-10-01 18:14:41 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-12 06:50:10 -05:00
|
|
|
interface RangePartitionsSpecProps {
|
|
|
|
readonly partitionDimensions: string[];
|
2020-10-01 18:14:41 -04:00
|
|
|
readonly targetRowsPerSegment: number | null;
|
|
|
|
readonly maxRowsPerSegment: number | null;
|
|
|
|
}
|
|
|
|
|
2022-01-12 06:50:10 -05:00
|
|
|
export interface RangePartitionsSpec extends RangePartitionsSpecProps {}
|
2020-10-01 18:14:41 -04:00
|
|
|
|
Web console basic end-to-end-test (#9595)
Load data and query (i.e., automate
https://druid.apache.org/docs/latest/tutorials/tutorial-batch.html) to
have some basic checks ensuring the web console is wired up to druid
correctly.
The new end-to-end tests (tutorial-batch.spec.ts) are added to
`web-console/e2e-tests`. Within that directory:
- `components` represent the various tabs of the web console. Currently,
abstractions for `load data`, `ingestion`, `datasources`, and `query`
are implemented.
- `components/load-data/data-connector` contains abstractions for the
different data source options available to the data loader's `Connect`
step. Currently, only the `Local file` data source connector is
implemented.
- `components/load-data/config` contains abstractions for the different
configuration options available for each step of the data loader flow.
Currently, the `Configure Schema`, `Partition`, and `Publish` steps
have initial implementation of their configuration options.
- `util` contains various helper methods for the tests and does not
contain abstractions of the web console.
Changes to add the new tests to CI:
- `.travis.yml`: New "web console end-to-end tests" job
- `web-console/jest.*.js`: Refactor jest configurations to have
different flavors for unit tests and for end-to-end tests. In
particular, the latter adds a jest setup configuration to wait for the
web console to be ready (`web-console/e2e-tests/util/setup.ts`).
- `web-console/package.json`: Refactor run scripts to add new script for
running end-to-end tests.
- `web-console/script/druid`: Utility scripts for building, starting,
and stopping druid.
Other changes:
- `pom.xml`: Refactor various settings disable java static checks and to
disable java tests into two new maven profiles. Since the same
settings are used in several places (e.g., .travis.yml, Dockerfiles,
etc.), having them in maven profiles makes it more maintainable.
- `web-console/src/console-application.tsx`: Fix typo ("the the").
2020-04-09 15:38:09 -04:00
|
|
|
/**
|
|
|
|
* Data loader partition step configuration.
|
|
|
|
*/
|
|
|
|
export class PartitionConfig {
|
|
|
|
constructor(props: PartitionConfigProps) {
|
|
|
|
Object.assign(this, props);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
interface PartitionConfigProps {
|
|
|
|
readonly segmentGranularity: SegmentGranularity;
|
2020-10-01 18:14:41 -04:00
|
|
|
readonly timeIntervals: string | null;
|
|
|
|
readonly partitionsSpec: PartitionsSpec | null;
|
Web console basic end-to-end-test (#9595)
Load data and query (i.e., automate
https://druid.apache.org/docs/latest/tutorials/tutorial-batch.html) to
have some basic checks ensuring the web console is wired up to druid
correctly.
The new end-to-end tests (tutorial-batch.spec.ts) are added to
`web-console/e2e-tests`. Within that directory:
- `components` represent the various tabs of the web console. Currently,
abstractions for `load data`, `ingestion`, `datasources`, and `query`
are implemented.
- `components/load-data/data-connector` contains abstractions for the
different data source options available to the data loader's `Connect`
step. Currently, only the `Local file` data source connector is
implemented.
- `components/load-data/config` contains abstractions for the different
configuration options available for each step of the data loader flow.
Currently, the `Configure Schema`, `Partition`, and `Publish` steps
have initial implementation of their configuration options.
- `util` contains various helper methods for the tests and does not
contain abstractions of the web console.
Changes to add the new tests to CI:
- `.travis.yml`: New "web console end-to-end tests" job
- `web-console/jest.*.js`: Refactor jest configurations to have
different flavors for unit tests and for end-to-end tests. In
particular, the latter adds a jest setup configuration to wait for the
web console to be ready (`web-console/e2e-tests/util/setup.ts`).
- `web-console/package.json`: Refactor run scripts to add new script for
running end-to-end tests.
- `web-console/script/druid`: Utility scripts for building, starting,
and stopping druid.
Other changes:
- `pom.xml`: Refactor various settings disable java static checks and to
disable java tests into two new maven profiles. Since the same
settings are used in several places (e.g., .travis.yml, Dockerfiles,
etc.), having them in maven profiles makes it more maintainable.
- `web-console/src/console-application.tsx`: Fix typo ("the the").
2020-04-09 15:38:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface PartitionConfig extends PartitionConfigProps {}
|