Skip to content

Commit 7e6ffe2

Browse files
Jonathan LuuJonathan Luu
authored andcommitted
merged dev changes with createTableAs
2 parents 9f3d23f + e8ff1fb commit 7e6ffe2

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

__tests__/integrationtests.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ const { default: waitForExpect } = require('wait-for-expect');
22
const ksqljs = require('../ksqljs/ksqlJS.js');
33
// Pre-requisite: start a docker container
44
/* To add to README: Prior to running test with 'npm test', please start the ksqlDB
5-
server using the command 'docker compose-up'. This will spin up a ksqlDB server on
6-
'http://localhost:8088'
5+
server using the command 'docker-compose up'. This will spin up a ksqlDB server on
6+
'http://localhost:8088'. If the command was run before, the created container might
7+
need to be removed first.
78
*/
89

910
// ** INTEGRATION TEST INSTRUCTIONS **
@@ -36,7 +37,7 @@ describe('--Integration Tests--', () => {
3637
}
3738
expect(streamExists).toEqual(true);
3839
})
39-
40+
4041
it('.push properly creates a push query', () => {
4142
let pushActive = false;
4243
client.push('SELECT * FROM TESTJESTSTREAM EMIT CHANGES LIMIT 1;', async (data) => {
@@ -46,14 +47,14 @@ describe('--Integration Tests--', () => {
4647
expect(pushActive).toEqual(true)
4748
});
4849
})
49-
50+
5051
it('.terminate properly terminates a push query', () => {
5152
client.push('SELECT * FROM TESTJESTSTREAM EMIT CHANGES LIMIT 3;', async (data) => {
5253
const terminateRes = await client.terminate(JSON.parse(data).queryId);
5354
expect(terminateRes.wasTerminated).toEqual(true);
5455
})
5556
})
56-
57+
5758
it('.insertStream properly inserts a row into a stream', async () => {
5859
const response = await client.insertStream('TESTJESTSTREAM', [
5960
{ "name": "stab-rabbit", "email": "123@mail.com", "age": 100 }
@@ -68,7 +69,7 @@ describe('--Integration Tests--', () => {
6869
}
6970
});
7071
})
71-
72+
7273
it('.pull receives the correct data from a pull query', async () => {
7374
const pullData = await client.pull("SELECT * FROM TESTJESTSTREAM;");
7475
console.log(pullData[1]);
@@ -130,7 +131,7 @@ describe('--Integration Tests--', () => {
130131
client = new ksqljs({ ksqldbURL: 'http://localhost:8088' });
131132
done();
132133
});
133-
134+
134135
afterAll(async () => {
135136
await client.ksql('DROP STREAM IF EXISTS TESTSTREAM2;');
136137
})
@@ -155,7 +156,7 @@ describe('--Integration Tests--', () => {
155156
queryId: null
156157
}));
157158
})
158-
159+
159160
it('.inspectServerInfo returns the server info and status', async () => {
160161
const status = await client.inspectServerInfo();
161162
// should return something like: {
@@ -174,7 +175,7 @@ describe('--Integration Tests--', () => {
174175
})
175176
}));
176177
})
177-
178+
178179
it('.inspectServerHealth returns the server health', async () => {
179180
const status = await client.inspectServerHealth();
180181
// should return something like: {
@@ -195,7 +196,7 @@ describe('--Integration Tests--', () => {
195196
})
196197
);
197198
})
198-
199+
199200
it('.inspectClusterStatus returns the cluster status', async () => {
200201
const status = await client.inspectClusterStatus();
201202
// should return something like: {
@@ -212,13 +213,13 @@ describe('--Integration Tests--', () => {
212213
})
213214
);
214215
})
215-
216+
216217
it('.isValidProperty returns true if a server configuration property is not prohibited from setting', async () => {
217218
const status = await client.isValidProperty('test');
218219
// should return true
219220
expect(status.data).toEqual(true);
220221
})
221-
222+
222223
// it('isValidProperty returns an error if the server property is prohibited from setting', async () => {
223224
// const status = await client.isValidProperty('ksql.connect.url');
224225
// // should return something like

ksqljs/ksqlJS.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,13 @@ class ksqljs {
224224
}
225225

226226
/**
227-
*
228-
* @param {string} streamName
229-
* @param {string[]} selectColumns
230-
* @param {string} sourceStream
231-
* @param {object} propertiesObj
232-
* @param {string} conditions
233-
* @param {string} partitionBy
227+
*
228+
* @param {string} streamName
229+
* @param {string[]} selectColumns
230+
* @param {string} sourceStream
231+
* @param {object} propertiesObj
232+
* @param {string} conditions
233+
* @param {string} partitionBy
234234
* @returns {Promise}
235235
*/
236236
createStreamAs = (streamName, selectColumns, sourceStream, propertiesObj, conditions, partitionBy) => {
@@ -555,10 +555,13 @@ class ksqljs {
555555
*
556556
* <p>This method may be used to terminate a ksqlDB cluster. First, shut down all the servers except one.
557557
*
558+
* @param {string[]} topicsToDelete an array of topic names or regular expressions for topic names to delete.
558559
* @return {Promise} this method returns a promise that returns a response object.
559560
*/
560-
terminateCluster() {
561-
return axios.post(this.ksqldbURL + `/ksql/terminate`, {}, {
561+
terminateCluster(topicsToDelete = []) {
562+
return axios.post(this.ksqldbURL + `/ksql/terminate`, {
563+
"deleteTopicList": topicsToDelete
564+
}, {
562565
headers: {
563566
// 'application/json' is the modern content-type for JSON, but some
564567
// older servers may use 'text/json'.

0 commit comments

Comments
 (0)