You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2026/04/07 08:53:15 UTC
(streampipes) 03/03: fix: restore compact adapter tests and script handling
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch fix-connect-e2e-tests
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit a1763fe790bdad831b351f207230b6390bf6dc43
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Apr 7 10:52:53 2026 +0200
fix: restore compact adapter tests and script handling
---
ui/cypress/support/utils/chart/ChartUtils.ts | 2 +-
ui/cypress/support/utils/connect/ConnectUtils.ts | 6 +-
.../connect/compact/addCompactAdapter.spec.ts | 174 ++++++++++-----------
.../compactAdapterWithTransformation.spec.ts | 2 +-
4 files changed, 90 insertions(+), 94 deletions(-)
diff --git a/ui/cypress/support/utils/chart/ChartUtils.ts b/ui/cypress/support/utils/chart/ChartUtils.ts
index d575f8126b..08f9ab319a 100644
--- a/ui/cypress/support/utils/chart/ChartUtils.ts
+++ b/ui/cypress/support/utils/chart/ChartUtils.ts
@@ -622,7 +622,7 @@ export class ChartUtils {
},
})
.then(response => {
- expect(response.status).to.be.oneOf([200, 404]);
+ expect(response.status).to.be.oneOf([200, 403, 404]);
});
}
diff --git a/ui/cypress/support/utils/connect/ConnectUtils.ts b/ui/cypress/support/utils/connect/ConnectUtils.ts
index b9d69e5671..f516cf70be 100644
--- a/ui/cypress/support/utils/connect/ConnectUtils.ts
+++ b/ui/cypress/support/utils/connect/ConnectUtils.ts
@@ -418,11 +418,7 @@ export class ConnectUtils {
? script
: `${ConnectUtils.TRANSFORMATION_SCRIPT_PREFIX}${script}`;
- const normalizedScript = scriptWithPrefix.trimEnd().endsWith('}')
- ? scriptWithPrefix
- : `${scriptWithPrefix.trimEnd()}\n}`;
-
- ConnectBtns.setConfigureSchemaScriptEditorValue(normalizedScript);
+ ConnectBtns.setConfigureSchemaScriptEditorValue(scriptWithPrefix);
ConnectBtns.configureSchemaScriptEditor().should(
'contain.text',
diff --git a/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts b/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts
index 167a206842..f2fe242cc5 100644
--- a/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts
+++ b/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts
@@ -26,79 +26,79 @@ describe('Add Compact Adapters', () => {
cy.initStreamPipesTest();
});
- // it('Add an adapter via the compact API. Do not start', () => {
- // const compactAdapter =
- // CompactAdapterUtils.getMachineDataSimulator().build();
- //
- // CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
- // ConnectUtils.validateAdapterIsStopped();
- //
- // PipelineUtils.checkAmountOfPipelinesPipeline(0);
- // });
- // });
- //
- // it('Add an adapter via the compact API. Start Adapter', () => {
- // const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
- // .setStart()
- // .build();
- //
- // CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
- // ConnectUtils.validateAdapterIsRunning();
- //
- // PipelineUtils.checkAmountOfPipelinesPipeline(0);
- // });
- // });
- //
- // it('Add an adapter via the compact API. Start Adapter and start persist pipeline', () => {
- // const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
- // .withTimestampProperty('timestamp')
- // .setStart()
- // .setPersist()
- // .build();
- //
- // CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
- // ConnectUtils.validateAdapterIsRunning();
- //
- // PipelineUtils.checkAmountOfPipelinesPipeline(1);
- // });
- // });
- //
- // it('Add an adapter via the compact API via yml API.', () => {
- // cy.readFile(
- // 'cypress/fixtures/connect/compact/machineDataSimulator.yml',
- // ).then(ymlDescription => {
- // CompactAdapterUtils.storeCompactYmlAdapter(ymlDescription).then(
- // () => {
- // ConnectUtils.validateAdapterIsStopped();
- // },
- // );
- // });
- // });
- //
- // it('Ensure correct error code when adapter with the same id already exists', () => {
- // const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
- // .withTimestampProperty('timestamp')
- // .setStart()
- // .setPersist()
- // .build();
- //
- // CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(
- // response => {
- // expect(response.status).to.equal(200);
- // ConnectUtils.checkAmountOfAdapters(1);
- //
- // // Store the same adapter a second time and validate that resource returns status of conflict
- // CompactAdapterUtils.storeCompactAdapter(
- // compactAdapter,
- // false,
- // ).then(response => {
- // expect(response.status).to.equal(409);
- //
- // ConnectUtils.checkAmountOfAdapters(1);
- // });
- // },
- // );
- // });
+ it('Add an adapter via the compact API. Do not start', () => {
+ const compactAdapter =
+ CompactAdapterUtils.getMachineDataSimulator().build();
+
+ CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+ ConnectUtils.validateAdapterIsStopped();
+
+ PipelineUtils.checkAmountOfPipelinesPipeline(0);
+ });
+ });
+
+ it('Add an adapter via the compact API. Start Adapter', () => {
+ const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
+ .setStart()
+ .build();
+
+ CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+ ConnectUtils.validateAdapterIsRunning();
+
+ PipelineUtils.checkAmountOfPipelinesPipeline(0);
+ });
+ });
+
+ it('Add an adapter via the compact API. Start Adapter and start persist pipeline', () => {
+ const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
+ .withTimestampProperty('timestamp')
+ .setStart()
+ .setPersist()
+ .build();
+
+ CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+ ConnectUtils.validateAdapterIsRunning();
+
+ PipelineUtils.checkAmountOfPipelinesPipeline(1);
+ });
+ });
+
+ it('Add an adapter via the compact API via yml API.', () => {
+ cy.readFile(
+ 'cypress/fixtures/connect/compact/machineDataSimulator.yml',
+ ).then(ymlDescription => {
+ CompactAdapterUtils.storeCompactYmlAdapter(ymlDescription).then(
+ () => {
+ ConnectUtils.validateAdapterIsStopped();
+ },
+ );
+ });
+ });
+
+ it('Ensure correct error code when adapter with the same id already exists', () => {
+ const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
+ .withTimestampProperty('timestamp')
+ .setStart()
+ .setPersist()
+ .build();
+
+ CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(
+ response => {
+ expect(response.status).to.equal(200);
+ ConnectUtils.checkAmountOfAdapters(1);
+
+ // Store the same adapter a second time and validate that resource returns status of conflict
+ CompactAdapterUtils.storeCompactAdapter(
+ compactAdapter,
+ false,
+ ).then(response => {
+ expect(response.status).to.equal(409);
+
+ ConnectUtils.checkAmountOfAdapters(1);
+ });
+ },
+ );
+ });
it('Ensure broken transformation script returns a clear client error', () => {
const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
@@ -123,18 +123,18 @@ describe('Add Compact Adapters', () => {
);
});
- // it('Add file stream adapter via the compact API. Start Adapter with Pipeline', () => {
- // FileManagementUtils.addFile('connect/compact/compactTest.csv');
- //
- // cy.readFile('cypress/fixtures/connect/compact/fileReplay.yml').then(
- // ymlDescription => {
- // CompactAdapterUtils.storeCompactYmlAdapter(ymlDescription).then(
- // () => {
- // ConnectUtils.validateAdapterIsRunning();
- // PipelineUtils.checkAmountOfPipelinesPipeline(1);
- // },
- // );
- // },
- // );
- // });
+ it('Add file stream adapter via the compact API. Start Adapter with Pipeline', () => {
+ FileManagementUtils.addFile('connect/compact/compactTest.csv');
+
+ cy.readFile('cypress/fixtures/connect/compact/fileReplay.yml').then(
+ ymlDescription => {
+ CompactAdapterUtils.storeCompactYmlAdapter(ymlDescription).then(
+ () => {
+ ConnectUtils.validateAdapterIsRunning();
+ PipelineUtils.checkAmountOfPipelinesPipeline(1);
+ },
+ );
+ },
+ );
+ });
});
diff --git a/ui/cypress/tests/connect/compact/compactAdapterWithTransformation.spec.ts b/ui/cypress/tests/connect/compact/compactAdapterWithTransformation.spec.ts
index 00a90ef055..7e25b40112 100644
--- a/ui/cypress/tests/connect/compact/compactAdapterWithTransformation.spec.ts
+++ b/ui/cypress/tests/connect/compact/compactAdapterWithTransformation.spec.ts
@@ -34,7 +34,7 @@ describe('Add Compact Adapters', () => {
' event.temperature_renamed = event.temperature \n' +
' delete event.temperature \n' +
' out.collect(event);\n' +
- '',
+ '}',
)
.setStart()
.build();