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

Sp 1132: Replace FileSet adapters with FileStream adapters in all e2e tests #1153

Merged
merged 6 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public class FileStreamProtocol extends Protocol {
private static final String SPEED_UP_FACTOR = "speedUpFactor";
private static final String FASTEST = "fastest";

private static final String SPEED_UP_FACTOR_GROUP = "speed-up-factor-group";


private static final Logger logger = LoggerFactory.getLogger(FileStreamProtocol.class);

Expand Down Expand Up @@ -300,7 +302,7 @@ public ProtocolDescription declareModel() {
Alternatives.from(Labels.withId(KEEP_ORIGINAL_TIME), true),
Alternatives.from(Labels.withId(FASTEST)),
Alternatives.from(Labels.withId(SPEED_UP_FACTOR),
StaticProperties.group(Labels.withId("speed-up-factor-group"),
StaticProperties.group(Labels.withId(SPEED_UP_FACTOR_GROUP),
StaticProperties.doubleFreeTextProperty(Labels.withId(SPEED_UP)))))
.build();
}
Expand Down
2 changes: 0 additions & 2 deletions ui/cypress/fixtures/connect/aggregationRules/expected.csv
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
timestamp;value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file intended to be empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, yes ;)
Thanks for the Review

1623871499000;2.0
2 changes: 1 addition & 1 deletion ui/cypress/support/builder/GenericAdapterBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class GenericAdapterBuilder {
return this;
}

public setFormat(format: 'csv' | 'json_array') {
public setFormat(format: 'csv' | 'json_array' | 'json_object') {
this.genericAdapterInput.format = format;
return this;
}
Expand Down
2 changes: 0 additions & 2 deletions ui/cypress/support/utils/DataDownloadDialogUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,10 @@ export class DataDownloadDialogUtils {
cy.dataCy('download-configuration-next-btn').click();

// Format
// cy.dataCy('download-configuration-json').click();
cy.dataCy(
`download-configuration-${exportConfig.formatExportConfig.exportFormat}`,
).click();
if ('delimiter' in exportConfig.formatExportConfig) {
// if ((exportConfig.formatExportConfig as CsvFormatExportConfig).delimiter !== undefined) {
cy.dataCy(
`download-configuration-delimiter-${
(exportConfig.formatExportConfig as CsvFormatExportConfig)
Expand Down
14 changes: 6 additions & 8 deletions ui/cypress/support/utils/PrepareTestDataUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,8 @@ export class PrepareTestDataUtils {
format,
storeInDataLake,
);
// ConnectUtils.addGenericStreamAdapter(adapter, 'sp-connect-adapter-gathering-live-preview');
ConnectUtils.addGenericStreamAdapter(adapter);

// Wait till data is stored
// if (storeInDataLake) {
// cy.wait(10000);
// }
ConnectUtils.addGenericStreamAdapter(adapter);
}

private static getDataLakeTestAdapter(
Expand All @@ -54,7 +49,11 @@ export class PrepareTestDataUtils {
const adapterBuilder = GenericAdapterBuilder.create('File_Stream')
.setName(name)
.setTimestampProperty('timestamp')
.addProtocolInput('input', 'speed', '1');
.addProtocolInput(
'radio',
'speed',
'fastest_\\(ignore_original_time\\)',
);

if (format === 'csv') {
adapterBuilder
Expand All @@ -69,7 +68,6 @@ export class PrepareTestDataUtils {

if (storeInDataLake) {
adapterBuilder.setStoreInDataLake();
adapterBuilder.setStartAdapter(false);
}

return adapterBuilder.build();
Expand Down
19 changes: 14 additions & 5 deletions ui/cypress/support/utils/ProcessingElementTestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { GenericAdapterBuilder } from '../builder/GenericAdapterBuilder';
import { PipelineBuilder } from '../builder/PipelineBuilder';
import { PipelineElementBuilder } from '../builder/PipelineElementBuilder';
import { ProcessorTest } from '../model/ProcessorTest';
import { ConnectBtns } from './connect/ConnectBtns';

export class ProcessingElementTestUtils {
public static testElement(pipelineElementTest: ProcessorTest) {
Expand All @@ -47,10 +48,16 @@ export class ProcessingElementTestUtils {
const adapterName = pipelineElementTest.name.toLowerCase();

// Build adapter
const adapterInputBuilder = GenericAdapterBuilder.create('File_Set')
const adapterInputBuilder = GenericAdapterBuilder.create('File_Stream')
.setName(adapterName)
.setTimestampProperty('timestamp')
.setFormat(formatType);
.setFormat(formatType)
.setStartAdapter(false)
.addProtocolInput(
'radio',
'speed',
'fastest_\\(ignore_original_time\\)',
);

if (formatType === 'csv') {
adapterInputBuilder
Expand All @@ -60,7 +67,7 @@ export class ProcessingElementTestUtils {

const adapterInput = adapterInputBuilder.build();

ConnectUtils.addGenericSetAdapter(adapterInput);
ConnectUtils.addGenericStreamAdapter(adapterInput);

// Build Pipeline
const pipelineInput = PipelineBuilder.create(pipelineElementTest.name)
Expand All @@ -76,8 +83,10 @@ export class ProcessingElementTestUtils {

PipelineUtils.addPipeline(pipelineInput);

// Wait till data is stored
cy.wait(10000);
ConnectUtils.goToConnect();
ConnectBtns.startAdapter().click();

cy.wait(3000);

DataLakeUtils.checkResults(
dataLakeIndex,
Expand Down
52 changes: 19 additions & 33 deletions ui/cypress/support/utils/connect/ConnectUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { ConnectBtns } from './ConnectBtns';
export class ConnectUtils {
public static testSpecificStreamAdapter(
adapterConfiguration: SpecificAdapterInput,
successElement = 'sp-connect-adapter-live-preview',
) {
ConnectUtils.goToConnect();

Expand All @@ -54,7 +53,7 @@ export class ConnectUtils {

ConnectEventSchemaUtils.finishEventSchemaConfiguration();

ConnectUtils.startStreamAdapter(adapterConfiguration, successElement);
ConnectUtils.startStreamAdapter(adapterConfiguration);
}

public static testGenericStreamAdapter(
Expand All @@ -65,21 +64,12 @@ export class ConnectUtils {

public static addGenericStreamAdapter(
adapterConfiguration: GenericAdapterInput,
successElement = 'sp-connect-adapter-live-preview',
) {
ConnectUtils.addGenericAdapter(adapterConfiguration);

ConnectUtils.startStreamAdapter(adapterConfiguration, successElement);
ConnectUtils.startStreamAdapter(adapterConfiguration);
}

// public static addGenericSetAdapter(
// adapterConfiguration: GenericAdapterInput,
// ) {
// ConnectUtils.addGenericAdapter(adapterConfiguration);
//
// ConnectUtils.startSetAdapter(adapterConfiguration);
// }

public static addGenericAdapter(adapterConfiguration: GenericAdapterInput) {
ConnectUtils.goToConnect();

Expand Down Expand Up @@ -188,23 +178,13 @@ export class ConnectUtils {
cy.get('#event-schema-next-button').click();
}

public static startStreamAdapter(
adapterInput: AdapterInput,
successElement = 'sp-connect-adapter-live-preview',
) {
ConnectUtils.startAdapter(adapterInput, successElement);
public static startStreamAdapter(adapterInput: AdapterInput) {
ConnectUtils.startAdapter(adapterInput);
}

// public static startSetAdapter(adapterInput: AdapterInput) {
// ConnectUtils.startAdapter(
// adapterInput,
// 'sp-connect-adapter-set-success',
// );
// }

public static startAdapter(
adapterInput: AdapterInput,
successElement: string,
noLiveDataView = false,
) {
// Set adapter name
cy.dataCy('sp-adapter-name').type(adapterInput.adapterName);
Expand All @@ -225,7 +205,15 @@ export class ConnectUtils {

ConnectBtns.adapterSettingsStartAdapter().click();

cy.dataCy(successElement, { timeout: 60000 }).should('be.visible');
if (adapterInput.startAdapter && !noLiveDataView) {
cy.dataCy('sp-connect-adapter-success-live-preview', {
timeout: 60000,
}).should('be.visible');
} else {
cy.dataCy('sp-connect-adapter-success-added', {
timeout: 60000,
}).should('be.visible');
}

this.closeAdapterPreview();
}
Expand Down Expand Up @@ -260,6 +248,7 @@ export class ConnectUtils {
'speed',
'fastest_\\(ignore_original_time\\)',
)
.addProtocolInput('radio', 'replayonce', 'yes')
.setName('Adapter to test rules')
.setFormat('csv')
.addFormatInput('input', 'delimiter', ';')
Expand Down Expand Up @@ -292,9 +281,9 @@ export class ConnectUtils {
cy.get('div').contains('Values').parent().click();

// Validate resulting event
cy.dataCy('sp-connect-adapter-live-preview', { timeout: 10000 }).should(
'be.visible',
);
cy.dataCy('sp-connect-adapter-success-live-preview', {
timeout: 10000,
}).should('be.visible');

// validate that three event properties
cy.get('.preview-row', { timeout: 10000 })
Expand All @@ -308,10 +297,7 @@ export class ConnectUtils {
ignoreTime: boolean,
waitTime = 0,
) {
ConnectUtils.startAdapter(
adapterConfiguration,
'sp-connect-adapter-gathering-live-preview',
);
ConnectUtils.startAdapter(adapterConfiguration, true);

// Wait till data is stored
cy.wait(waitTime);
Expand Down
16 changes: 9 additions & 7 deletions ui/cypress/support/utils/datalake/DataLakeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ export class DataLakeUtils {
storeInDataLake: boolean = true,
format: 'csv' | 'json_array',
) {
const adapterBuilder = GenericAdapterBuilder.create('File_Set')
const adapterBuilder = GenericAdapterBuilder.create('File_Stream')
.setName(name)
.setTimestampProperty('timestamp')
.addDimensionProperty('randomtext');
.addDimensionProperty('randomtext')
.addProtocolInput(
'radio',
'speed',
'fastest_\\(ignore_original_time\\)',
)
.setStartAdapter(true);

if (format === 'csv') {
adapterBuilder
Expand Down Expand Up @@ -67,12 +73,8 @@ export class DataLakeUtils {
true,
format,
);
ConnectUtils.addGenericAdapter(adapter);

// Wait till data is stored
if (wait) {
cy.wait(10000);
}
ConnectUtils.addGenericStreamAdapter(adapter);
}

public static addDataViewAndWidget(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ describe('Creates a new adapter without starting it', () => {
.setStartAdapter(false)
.build();

ConnectUtils.testSpecificStreamAdapter(
adapterInput,
'sp-connect-adapter-not-started-success',
);
ConnectUtils.testSpecificStreamAdapter(adapterInput);

ConnectUtils.startAndValidateAdapter(7);

Expand Down
4 changes: 1 addition & 3 deletions ui/cypress/tests/adapter/formats/format.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ const navigateToFormatSelection = () => {

ConnectUtils.selectAdapter('File_Stream');

ConnectUtils.configureAdapter(
UserInputBuilder.create().add('input', 'speed', '1').build(),
);
ConnectUtils.configureAdapter([]);
};

const validateResult = expected => {
Expand Down
2 changes: 1 addition & 1 deletion ui/cypress/tests/adapter/rules/streamRules.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ describe('Connect aggregation rule transformations', () => {

ConnectEventSchemaUtils.markPropertyAsTimestamp('timestamp');
ConnectEventSchemaUtils.finishEventSchemaConfiguration();

cy.dataCy('connect-reduce-event-rate-box').children().click();
cy.dataCy('connect-reduce-event-input').type('2000');

ConnectUtils.tearDownPreprocessingRuleTest(
adapterConfiguration,
'cypress/fixtures/connect/aggregationRules/expected.csv',
false,
2000,
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('Test live data download dialog', () => {
'dataDownloadDialog/input.json',
'json_array',
);

DataLakeUtils.addDataViewAndTableWidget(dataViewName, 'Persist');
DataLakeUtils.saveDataExplorerWidgetConfiguration();
});
Expand Down
1 change: 0 additions & 1 deletion ui/cypress/tests/datalake/deleteWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ describe('Test Table View in Data Explorer', () => {
beforeEach('Setup Test', () => {
cy.initStreamPipesTest();
DataLakeUtils.loadDataIntoDataLake('datalake/sample.csv', false);
// cy.login();
});

it('Perform Test', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ describe('Test Table View in Data Explorer', () => {
beforeEach('Setup Test', () => {
cy.initStreamPipesTest();
DataLakeUtils.loadDataIntoDataLake('datalake/sample.csv');
// cy.login();
// DataLakeUtils.goToDatalake();
});

it('Perform Test', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h3>Gathering data for live preview...</h3>
</div>
</div>
</div>
<div *ngIf="runtimeData" data-cy="sp-connect-adapter-live-preview">
<div *ngIf="runtimeData" data-cy="sp-connect-adapter-success-live-preview">
<p>Here is a preview of your data:</p>
<table class="dataTable row-border hover">
<thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ <h3>Adapter successfully updated</h3>
fxLayout="row"
>
<i class="material-icons">done</i>
<span
data-cy="sp-connect-adapter-not-started-success"
<span data-cy="sp-connect-adapter-success-added"
>&nbsp;Your new data stream is now available in
the pipeline editor.</span
>
Expand Down